none
Excel Macro issue RRS feed

  • Question

  • My excel macro runs in excel 2010 but fails to run in excel 2013. I get "Error #-2147012891: Automation error", can anyone help me?

    Here is the code I am using. It fails on the m_XML.Open.

        Dim m_XML As Object
        Set m_XML = CreateObject("Msxml2.XMLHTTP")
        
        Set ie = New InternetExplorerMedium

        m_XML.Open "POST", m_URL, False
        m_XML.Send
        Dim m_XMLDoc As New MSHTML.HTMLDocument
         
        If m_XML.Status = 200 Then
            m_XML.getAllResponseHeaders
            m_XMLDoc.body.innerHTML = m_XML.responseText
            Debug.Print m_XMLDoc.body.innerHTML
        End If

    Thursday, September 7, 2017 1:14 PM

Answers

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel features, please provide your problem code and I'll move your question to the MSDN forum for Excel Developer:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Regards,
    Emi Zhang
    TechNet Community Support

    Please remember to mark the replies as answers if they helped.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, September 8, 2017 2:48 AM
  • Hi Sacina,

    can you post your sample code.

    we can try to test your code on our side and try to find the issue.

    with only error message, it is not possible to know what cause this issue.

    you can also post your workbook with dummy data in it on free resource sharing website.

    we will try to download it and make a test with that.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, September 8, 2017 7:18 AM
    Moderator
  • Hi Sacina,

    can you tell us what is the value of m_URL?

    is that url is accessible from that machine , try to check it.

    also check you add the references properly.

    let us know about your testing result. so that we can try to provide further suggestions.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 12, 2017 6:34 AM
    Moderator
  • Hi Sacina,

    is your issue solved?

    I can see that , you did not follow up this thread after posting the issue.

    if your issue is solved. I suggest you to post the solution and mark it as an answer.

    if your issue is still exist then try to refer the suggestions provided by me and try to provide the information I asked.

    so that we can try to provide further suggestions to you.

    thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 18, 2017 7:33 AM
    Moderator
  • The variable, 'm_URL', is empty in the code, you're giving, thus, the code will fail...
    Monday, September 18, 2017 8:38 AM
  • Here is the value m_URL

    http://user:password@wc.cpautmtive.com/Windchill/servlet/IE/tasks/ext/bec/CreateAffectedObjectLink.xml?CRPAutoPartNumber=CHR0001P&ChangeActivityNumber=05001

    The user id and password has been altered for security reasons.

    Monday, September 18, 2017 12:49 PM
  • You can not embed username and password into the URL.

    Here's how to do it:
    https://support.microsoft.com/en-us/help/832414/xmlhttp-call-fails-for-urls-with-embedded-user-credentials

    Monday, September 18, 2017 5:41 PM
  • My issue has been resolved. Thank you so much for the help. Removing the user ID and password from the URL solved the problem. I am very thankful for the help Deepak.
    Tuesday, September 19, 2017 11:34 AM
  • Remember to mark the answer :-)
    Tuesday, September 19, 2017 11:46 AM