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)