Hello All,
I am currently trying to extract information from my company's sharepoint site. At the moment, I'm not quite sure what I'm doing as this is my first time truly coding. I started using VBA as a temporary process as my main job is not programming or software development--been using it for about 2 weeks. I am looking to take one of the tables (represented as a list) then transfer it an excel document. The table I was told needs to be exported and formatted as XML. From a previous forum, I altered some code:
Sub ImportSharePointList() Dim objMyList As ListObject Dim objWksheet As Worksheet Dim strSPServer As String Const SERVER As String= "'sharepointsite'.'companyname'.com'" Const LISTNAME As String = "{6D3EB7C9-1C42-4D2F-87A0-8BF04E2D1A2E}" Const VIEWNAME As String ' The SharePoint server URL pointing to ' the SharePoint list to import into Excel. strSPServer = "http://" & SERVER & "/_vti_bin" 'strSPServer ' Add a new worksheet to the active workbook. Set objWksheet = Worksheets.Add ' Add a list range to the newly created worksheet ' and populated it with the data from the SharePoint list. Set objMyList = objWksheet.ListObjects.Add(xlSrcExternal, Array(strSPServer, _ LISTNAME, VIEWNAME), True, , Range("a1")) Set objMyList = Nothing Set objWksheet = Nothing End SubWhen I run this I keep getting the same error, "Excel cannot connect to the SharePoint list" (Error: "1004"). Any help would be greatly appreciated, as I honestly have no idea what I'm doing here.