SharePoint tools Excel Macro reads SharePoint list data (VBA)

Source: Internet
Author: User

First, the development reason:

Sometimes SharePoint lists are not easy to manipulate, such as large amounts of data and the need to process data in batches. There are too many restrictions through the server code, such as intelligence through the B/s sent to the user, slow and affect the performance of the server.
The client code is also somewhat slow.

Second, the specific interface:

The third specific code:

Private SubGetlistbut_click () on Error GoToErrorHandler application.screenupdating=FalseApplication.DisplayAlerts=False    SetClsmosshelper =NewCmosshelperDimMyTable asListObjectDimMyrow asListRowDimListName as String    DimXmlDoc asmsxml2.domdocumentDimXmlNode asMSXML2. IXMLDOMNodeDimXmlAttribute asMSXML2. IxmldomattributeSetMyTable = ActiveWorkbook.Sheets ("Sheet1"). ListObjects ("Table1") Clsmosshelper.init"AAA","Http://AAA:222/yixiaozi"ListName="ABC"        DimViewName as String    'fortoolupdateViewName ="{F5022E21-7A8D-40C1-B327-D9DB9E227F33}"    'ViewName = "{324dd64b-ed68-4e86-83d0-321e1ab2d403}"         for  eachMyrowinchmytable.listrowsDimQuery as StringQuery="<query><query><where><eq><fieldref name= ' Title '/><value Type= ' Text ' > "Query= Query & MyRow.Range.Columns (1). Value Query= Query &"</Value>"Query= Query &"</Eq></Where></Query></query>"                'query = "<query><query><where><and><eq><fieldref name= ' Title '/><Value Type= ' Text ' > '        'query = query & "A"        'query = query & "</Value>"        'query = query & ' </eq><eq><fieldref name= ' description '/><value type= ' Text ' > '        'query = query & "2"        'query = query & "</Value></Eq></And></Where></Query></query>"                DimBlnflag as Boolean        DimErrorMsg as String        DimRetdata as StringBlnflag=Clsmosshelper.getlistitems (listname, viewName, query, Retdata, errormsg)IfBlnflag =True  Then                                      Setxmldoc =Newmsxml2.domdocument xmldoc.loadxml Retdata for  eachXmlNodeinchXmldoc.selectnodes ("//rs:data/z:row")            DimDescriptionSetDescription = XmlNode.Attributes.getNamedItem ("ows_description")                                IfDescription is  Nothing  ThenDescription=""                ElseDescription=description. TextEnd IfMyRow.Range.Columns (2). Value =DescriptionNext        Else            MsgBoxerrormsgEnd If    Next    SetXmlAttribute = Nothing    SetXmlNode = Nothing    Setxmldoc = Nothing        SetClsmosshelper = Nothingapplication.screenupdating=TrueApplication.DisplayAlerts=True        MsgBox "OK"Exit SubErrorHandler:If  notXmlAttribute is  Nothing  Then        SetXmlAttribute = Nothing    End If        If  notXmlNode is  Nothing  Then        SetXmlNode = Nothing    End If        If  notXmlDoc is  Nothing  Then        Setxmldoc = Nothing    End If        If  notClsmosshelper is  Nothing  Then        SetClsmosshelper = Nothing    End Ifapplication.screenupdating=TrueApplication.DisplayAlerts=True        MsgBoxErr.DescriptionEnd Sub

IV: Excel file.

Http://files.cnblogs.com/files/yixiaozi/getListData.zip

SharePoint tools Excel Macro reads SharePoint list data (VBA)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.