Excel 2007 Macro not working in Excel 2013

amalejko

New Member
Joined
May 1, 2014
Messages
5
We are migrating to Excel 2013 and one of our uploads that we do via Excel is not working in the 2013 version. We had a similar issue on another upload that was corrected by changing the reference to 6.0 which we did with this one as well and replacing XMLHTTPREQUEST with XMLHTTP60 however this macro is different. It errors on If xDoc.Load(strXML) Then

Any thoughts as to why this code would not work in Excel 2013? I do have msxml6.dll in the sysWOW64 directory. Also tried using msxml 3 reference with same results.

Thanks! Amy
Code:
Private Function sendXML(strXML, strResponse, strURL As String) As Long
Dim xDoc As MSXML2.DOMDocument
Dim xHTTP As MSXML2.XMLHTTP
'Dim xError, xImported, xUpdated As MSXML2.IXMLDOMElement
Dim xError, xImported, xUpdated As MSXML2.IXMLDOMNodeList
Dim tmp, tmp2 As String
Dim StatusNum As Long
Dim i, k As Integer
Dim Y, M, D, Dsep, Jdate As String
Dim Dorder As Integer
    
    On Error GoTo doError
    strResponse = ""
    Set xDoc = New MSXML2.DOMDocument
    xDoc.async = False
    
    If xDoc.Load(strXML) Then <-----------------------------error occurs here
        Set xHTTP = New MSXML2.XMLHTTP
        
        xHTTP.Open "POST", strURL, False
        
        xHTTP.setRequestHeader "content-type", "application/x-www-form-urlencoded"
        xHTTP.setRequestHeader "accept", "text/xml/html"
        xHTTP.setRequestHeader "accept-charset", "utf-8, iso_8859-1"

        xHTTP.send xDoc.XML
 
Last edited by a moderator:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What's the actual error message?
 
Upvote 0
This is where the macro stops and I receive "An error occured during the upload. Please check to make sure your settings are correct."
My settings are all correct so it has to be something within the sendXML?

Thank you! Amy


Sub PostXLS()

XLStoXML
ResponseInfo = sendXML(Left(ThisWorkbook.FullName, Len(ThisWorkbook.FullName) - Len(ThisWorkbook.Name)) & "//DEST.XML", ResponseInfo, Sheets(1).Range("C2"))
If ResponseInfo <> 0 Then
MsgBox "An error occured during the upload. Please check to make sure your settings are correct.", vbCritical, "Error"
End If


End Sub
 
Upvote 0
Are you sure the XML you are trying to load is correct?

If you step through the code do you get an error message on the Load statement?
 
Upvote 0
Are you sure the XML you are trying to load is correct?

If you step through the code do you get an error message on the Load statement?

I do not get an error on the load. I am confident the XML is correct as when I run it in Excel 2007, the same XML file loads without issue. I am thinking it is something to do with the libraries maybe?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top