有人可以帮助我如何在Excel中更改视图,这与Sharepoint中的列表相关联?这是我的VBA代码:
Sub link_edit_Mode()
Dim mySh As Worksheet
Dim spSite As String
Set mySh = Sheets("one")
Dim src(0 To 1) As Variant
spSite = " url " 'site name
src(0) = spSite & "/_vti_bin"
src(1) = "{lists GUID}" 'GUID
mySh.ListObjects.Add xlSrcExternal, src, True, xlYes, mySh.Range("A1")
End Sub
它有效,但是它给了我sharepoint的表,它有默认视图,但我需要改变这个视图。
答案 0 :(得分:1)
您需要对代码进行细微更改(请参阅下文)
Sub link_edit_Mode()
Dim mySh As Worksheet
Dim spSite As String
Set mySh = Sheets("one")
Dim src(0 To 2) As Variant
spSite = " url " 'site name
src(0) = spSite & "/_vti_bin"
src(1) = "{lists GUID}" 'GUID
src(2) = "{view GUID}"
mySh.ListObjects.Add xlSrcExternal, src, True, xlYes, mySh.Range("A1")
End Sub