Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:27:26+00:00 2026-06-06T04:27:26+00:00

I’m trying to add an item to a Sharepoint list using VBA. I don’t

  • 0

I’m trying to add an item to a Sharepoint list using VBA. I don’t want the user to have to install anything, so I’m just using Microsoft Soap Type Library. Code as follows:

Sub test()

Dim soap As MSSOAPLib.SoapClient
Dim XMLstr As String
Dim listid As String
Dim listname As String

Set soap = New SoapClient
Call soap.mssoapinit(bstrwsdlfile:="http://wss/mySharepointSite/_vti_bin/lists.asmx?wsdl")


listid = "{e285aa1a-my-list-ID-d446cdbf091e}"
listname = "thisList"

XMLstr = "<Method ID='1' Cmd='New'>" & _
            "<Field Name='ID'>New</Field>" & _
            "<Field Name='personID'>1337</Field>" & _
        "</Method>"

soap.UpdateListItems listid, XMLstr

End Sub

I keep getting a “Type Mismatch” error on the soap.UpdateListItems line, regardless of whether I use listid or listname as the first parameter. I tried reading the WSDL to determine what type of parameter should be passed, but I don’t understand it. What should I be passing here?

EDIT: I got it to work by using Microsoft Soap Type Library 3.0 instead, changing MSSOAPLib.SoapClient->MSSOAPLib30.SoapClient30 and bstrwsdlfile->par_wsdlfile, and surrounding XMLstr with:

<Batch OnError='continue' ListVersion='1' ViewName='" & ListView & "'>

...

</Batch>

Still trying to work out a way to do this without requiring users to install MSSoap 3.0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:27:28+00:00Added an answer on June 6, 2026 at 4:27 am

    I solved this by sending the XML as an HTTP POST, submitted via MSXML2.XMLHTTP. Code as follows:

    Function updateSharePointList(listURL as string, list As String) As DOMDocument
    
    Dim xmlhtp As New MSXML2.XMLHTTP
    Dim XMLDOC As New DOMDocument
    Dim xmlstr as String
    
    xmlstr = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
    "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" & _
      "<soap12:Body>" & _
        "<UpdateListItems xmlns=""http://schemas.microsoft.com/sharepoint/soap/"">" & _
          "<listName>" & list & "</listName>" & _
          "<updates>" & _
            "<Batch OnError='continue' ListVersion='1'>" & _
            "<Method ID='1' Cmd='New'>" & _
                "<Field Name='ID'>New</Field>" & _
                'all of your field updates go here, e.g.: 
                "<Field Name='userID'>1337</Field>" & _
                "<Field Name='comment'>first!</Field>" & _
            "</Method>" & _
            "</Batch>" & _
            "</updates>" & _
        "</UpdateListItems>" & _
      "</soap12:Body>" & _
    "</soap12:Envelope>"
    
    With xmlhtp
            .Open "POST", listURL, False
            .setRequestHeader "Host", "wss"
            .setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
    
            .send xmlstr
    
            XMLDOC.LoadXML .responseText
            Set updateSharePointList = XMLDOC
    
    End With
    
    End Function
    

    This requires a reference to Microsoft XML (I used “Microsoft XML, v6.0”), which AFAIK is in any standard set of VBA references. No DLL registration is needed. The function returns a DOMDocument with the result XML returned by UpdateListItems, which you can parse to do error checking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.