试图从Sharepoint导入列表到Excel
问题描述:
我想将一个Sharepoint列表导入Excel 2010工作表。下面 的代码工作于2003年,但在Excel 2010中试图从Sharepoint导入列表到Excel
Set TempSheet = ThisWorkbook.Sheets.Add
TempSheet.Name = ("TEMP")
Set TempSheet2 = Sheets("TEMP")
TempSheet2.Activate
------ the code below is the issue ----------------
Dim src(2) As Variant
src(0) = "https://collaborate.statestr.com/sites/CASG/exceptions/_vti_bin/"
src(1) = "{72B6638E-0E7B-4B37-A6A5-3142033E4E02}"
src(2) = "{163702D0-A380-467F-B883-1195F4F40616}"
TempSheet2.ListObjects.Add xlSrcExternal, src, True, xlYes, TempSheet2.Range("A2")
不工作我得到的运行时错误信息1004初始化数据源的失败。
答
我自己并没有遇到这种情况,但OfficeWriter有一个SharePoint列表插件,可以将数据从列表导出到Excel工作簿中。见http://www.officewriter.com/sharepoint。免责声明:我没有在这个插件上工作,但我在最后一个版本的OfficeWriter上工作。
http://sharepoint.stackexchange.com/questions/29021/import-sharepoint-list-int-excel-using-vba-only –
我试过这段代码,并得到与上述用户相同的错误信息。这与我在宏中使用的代码基本相同。 –