XMLHTTP Request - Macro works under Win 10, does not work under Win 7

Vokas

New Member
Joined
Aug 31, 2013
Messages
6
Hello,

I'm trying to add an item to Sharepoint list from local excel file and I made a macro that works in Windows 10 but does not work under Windows 7.
I get Http.status 500 (Internal Server error) in debug window when i execute macro on Windows 7.

Anyone has a suggestion how to make this works in Windows 7?

Macro Below:
Code:
Sub ShPointUpload()

Dim objXMLHTTP As MSXML2.XMLHTTP

        Dim strListNameOrGuid As String
        Dim strBatchXml As String
        Dim strSoapBody As String
        Dim ListName As String
        Dim SharepointUrl As String
        Dim FieldNameVar As String
        Dim SrBroj As String
        Dim Kesh As String
        
          
        
        ListName = "" (here goes my list name)
        SharepointUrl = "" (here goes my Sharepoint site)                  
        SrBroj = ActiveCell.Value
        Kesh = ActiveCell.Offset(0, 2).Value
                
        Set objXMLHTTP = New MSXML2.XMLHTTP
        strListNameOrGuid = ListName


        'Add New Item'
         strBatchXml = "Here goes strbach info, which data i insert in which column (like FieldName, Value of that field, etc)"

      

        objXMLHTTP.Open "POST", SharepointUrl + "_vti_bin/Lists.asmx", False
        objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=""UTF-8"""
        objXMLHTTP.setRequestHeader "SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems"

        strSoapBody = "<soap:envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "="" _
            & "xmlns:xsd='http://www.w3.org/2001/XMLSchema' " _
         & "xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:body><updatelistitems "="" _
            & "xmlns='http://schemas.microsoft.com/sharepoint/soap/'><listname>" & strListNameOrGuid _
         & "</listname><updates>" & strBatchXml & "</updates></updatelistitems></soap:body></soap:envelope>"

        objXMLHTTP.Send (strSoapBody)
        If objXMLHTTP.Status = 200 Then
            'MsgBox "Sharepoint entry created successfully."
         Debug.Print (objXMLHTTP.Status)
        End If

        Set objXMLHTTP = Nothing
        'MsgBox Application.UserName
        
        
End Sub

Thank you in advance.
 
Last edited:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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