[英]excel 2010 getting data from a sharepoint list
I need to get data from a SharePoint list. 我需要从SharePoint列表中获取数据。 I came across the below code and I have tried many different combination of the urls etc. But I keep getting 我遇到了下面的代码,并且尝试了url等的许多不同组合。但是我不断
“Run-Time error 1004” “Application-define or object-define error” “运行时错误1004”“应用程序定义或对象定义错误”
I have full admin rights to the site I'm using SharePoint 2010 with Excel 2010 我对使用SharePoint 2010和Excel 2010的网站具有完全管理员权限
Here the code I have found: 在这里,我找到了代码:
Sub ImportSharePointList()
Dim objMyList As ListObject
Dim objWksheet As Worksheet
Dim strSPServer As String
Const SERVER As String = "xxx.xxx.net/sites/tss_PP/Lists"
Const LISTNAME As String = "{F915A40C-0394-418C-AB90-xxxxxxxxxxxxx}"
Const VIEWNAME As String = ""
' The SharePoint server URL pointing to
' the SharePoint list to import into Excel.
strSPServer = "https://" & SERVER & "/_vti_bin"
' Add a new worksheet to the active workbook.
Set objWksheet = ActiveSheet
Set objMyList = objWksheet.ListObjects.Add(xlSrcExternal, _
Array(strSPServer, LISTNAME, VIEWNAME), True, , Range("A2"))
Set objMyList = Nothing
Set objWksheet = Nothing
End Sub
Any help would be great, just a note I have tried this with and without a view name 任何帮助都将是很大的,只是我在有和没有视图名称的情况下尝试过的注释
Your code works well here (Excel 2010, SHP-2007) if I set the variables as following: 如果我将变量设置如下,则您的代码在这里工作良好(Excel 2010,SHP-2007):
Const SERVER As String = "shp.myserver.myorg/sites/[mainsite]/[subsite]"
Const LISTNAME As String = "Country" ' real List name
Const VIEWNAME As String = ""
server: I do not include /List or any other suffix, only down to the subsite level 服务器:我不包括/ List或任何其他后缀,仅包括子站点级别
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.