Name
listobject.Publish(Target, LinkSource)
Synopsis
Shares a worksheet list on a SharePoint server. Returns a string containing the address of the list on the Web.
|
Argument |
Settings |
|---|---|
|
|
The full address of the SharePoint server to share the list on. Includes the |
|
|
True links the contents of the worksheet list to the SharePoint list for synchronization. False copies the list to the SharePoint server, but does not link the contents. |
The following code shares a list on a worksheet and displays the location of the list once it is shared:
Sub ShareList( )
Dim ws As Worksheet, lst As ListObject
Dim str As String, dest(2) As Variant
Set ws = ActiveSheet
Set lst = ws.ListObjects("Test List")
dest(0) = "http://www.excelworkshop.com"
dest(1) = "Test List"
dest(2) = "A description goes here..."
str = lst.Publish(dest, True)
' Display the shared list in the browser.
ThisWorkbook.FollowHyperlink str
End SubThe name of the list (Test List in preceding code) must be unique within the SharePoint site. If a list with that name already exists, an error occurs and the list is not shared.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access