如何解决使用Excel VBA删除还是覆盖SharePoint列表?
我可以使用带有以下代码段的Excel VBA轻松添加创建SharePoint列表的方法:
ActiveSheet.ListObjects("Table3").Publish Array( _
"http://sitebuilder2.xyzcompany.com/operations","test1"),False
但是,如果我使用相同的列表名称(“ test1”),因为该列表已经存在,则会收到“运行时错误'3003':应用程序定义的错误或对象定义的错误”。
是否存在使用Excel VBA在SharePoint中覆盖列表(“ test1”)或删除列表(“ test1”)的简便方法,以便我可以在不提供新列表名称的情况下更新整个列表? / p>
解决方法
我能够使用此代码同步到SharePoint列表。
Private Sub PublishRW()
Dim listPoint As Range
Dim fullServerName As String
Dim retUrl As String
Set listPoint = ActiveCell.ListObject.Range(1,1)
fullServerName = ServerName.Value & "_vti_bin"
If ListDescription.Value = "" Then
retUrl = ActiveCell.ListObject.Publish(Array(ServerName.Value,ListName.Value),False)
Else
retUrl = ActiveCell.ListObject.Publish(Array(ServerName.Value,ListName.Value,ListDescription.Value),False)
End If
If retUrl <> "" Then
ActiveCell.ListObject.Delete
ActiveSheet.ListObjects.Add xlSrcExternal,Array(fullServerName,True,xlYes,listPoint
Else
MsgBox "There was an error during publish,please check the server name"
End If
Unload ExportRWList
End Sub
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。