SharePointURL Property

Microsoft Excel Visual Basic

SharePointURL Property

Returns a String representing the URL of the SharePoint list for a given ListObject object. Read-only String.

expression.SharePointURL

expression    Required. An expression that returns a ListObject object.

Remarks

Accessing this property generates a run-time error if the list is not linked to a SharePoint site.

Example

The following example sets elements of the Target parameter of the Publish method to push the ListObject object to a SharePoint site. The code sample uses the SharePointURL property to assign the URL to the array and the Name property to assign the name of the list. The information in the array is then passed to the SharePoint site using the Publish method.

    Sub PublishList()
   Dim wrksht As Worksheet
   Dim objListObj As ListObject
   Dim arTarget(4) As String
   Dim strSTSConnection As String
   
   Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
   Set objListObj = wrksht.ListObjects(1)
   
   arTarget(0) = "0"
   arTarget(1) = objListObj.SharePointURL
   arTarget(2) = "1"
   arTarget(3) = objListObj.Name
   
   strSTSConnection = objListObj.Publish(arTarget, True)
End Sub