Remarks
The FileName property returns or sets the location and name of the HTML file.
Publish method as it applies to the ListObject object.
Publishes the ListObject object to a server that is running Microsoft Windows SharePoint Services. Returns a String which is the URL of the published list on the SharePoint site.
expression.Publish(Target, LinkSource)
expression Required. An expression that returns a ListObject object.
Target Required Variant. Contains an Array of Strings. The following table describes the elements of this array:
Element# Contents
0 URL of SharePoint server
1 ListName (Display Name)
2 Description of the list. Optional.
LinkSource Required Boolean.
Remarks
If the ListObject object is not currently linked to a list on a SharePoint site, setting LinkSource to True will create a new list on the specified SharePoint site. If the ListObject object is currently linked to a SharePoint site, setting LinkSource argument to True will replace the existing link (you can only link the list to one SharePoint site). If the ListObject object is not currently linked, setting LinkSource to False will leave the ListObject object unlinked. If the ListObject object is currently linked to a SharePoint site, setting LinkSource to False will keep the ListObject object linked to the current SharePoint site.
Example
This example saves the range D5:D9 on the First Quarter worksheet in the active workbook to a Web page named stockreport.htm. The Spreadsheet component is used to make the Web page interactive.
ActiveWorkbook.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:="\\Server2\Q1\stockreport.htm", _
Sheet:="First Quarter", _
Source:="D5:D9", _
HTMLType:=xlHTMLCalc).Publish
The following example sets elements of the Target parameter to publish the ListObject object to the SharePoint site named "MyServer". In this example, it is assumed that the ListObject object is not currently linked to another list source, so setting the LinkSource argument to True creates a new two-way link between this list and the list on the target SharePoint site.
Dim objWrksht as Worksheet
Dim objListobj as ListObject
Dim strURL as String
Set objWrksht = ActiveWorkbook.Worksheets("Sheet1")
Set objListObj = objWrksht.ListObjects(1)
strURL = objListObj.Publish(Array("HTTP://MyServer", "MyList", "Description of my list"), True)
Bookmarks