简体   繁体   English

Excel 2010从共享点列表中获取数据

[英]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.

相关问题 使用VBA从Excel表导入Sharepoint 2010列表数据 - Import Sharepoint 2010 list data from Excel table using VBA 如何将Excel数据集导出到Sharepoint Access 2010列表? - How to Export an Excel data set to a Sharepoint Access 2010 list? sharepoint 2010导出到excel过滤列表 - sharepoint 2010 export to excel filtered list Excel 2010与SharePoint 2010的列表同步:第20行中的错误 - Excel 2010 List Synchronization with SharePoint 2010: Bug in the row 20 如何通过 Excel VBA 代码手动传递用户名和密码以获取 SharePoint 2010 列表数据 - How to manually pass username & password to get SharePoint 2010 List data via Excel VBA Code 使用 VBA 从 Excel 将数据添加到 Sharepoint 2013 列表 - Add data to Sharepoint 2013 list from Excel with VBA 有没有办法以编程方式将数据列表从sharepoint下载到excel中 - is there any way to programatically download data list from sharepoint into excel PowerApps - 将数据从 SharePoint 列表导出到 Excel(列顺序问题) - PowerApps - Export data from SharePoint list to Excel (issue with column order) 将数据从Outlook 2010导入Excel 2010 - Importing Data from Outlook 2010 into Excel 2010 JSON 未获取 VBA Excel 2010 中的数据集合 - JSON not getting the collection of data in VBA Excel 2010
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM