Syntax

expression.Add(SourceType, FileName, Sheet, Source, HtmlType, DivID, Title)

expression A variable that represents a PublishObjects object.

Parameters

Name Required/Optional Data Type Description
SourceType Required . The source type.
Title Optional Variant String. The URL (on the intranet or the Web) or path (local or network) to which the source object was saved.
Sheet Optional Variant The name of the worksheet that was saved as a Web page.
Source Optional Variant A unique name used to identify items that have one of the following constants as their SourceType argument: xlSourceAutoFilter, xlSourceChart, xlSourcePivotTable, xlSourcePrintArea, xlSourceQuery, or xlSourceRange. If SourceType is xlSourceRange, Source specifies a range, which can be a defined name. If SourceType is xlSourceChart, xlSourcePivotTable, or xlSourceQuery, Source specifies the name of a chart, PivotTable report, or query table.
HtmlType Optional Variant Specifies whether the item is saved as an interactive Microsoft Office Web component or as static text and images. Can be one of the constants: xlHtmlCalc, xlHtmlChart, xlHtmlList, or xlHtmlStatic.
DivID Optional Variant The unique identifier used in the HTML DIV tag to identify the item on the Web page.
Title Optional Variant The title of the Web page.

Return Value
A object that represents the new item.

Remarks

Example

This example saves the range D5:D9 on the First Quarter worksheet in the active workbook to a Web page called Stockreport.htm. You use the Spreadsheet component to add interactivity to the Web page.

Visual Basic for Applications
ActiveWorkbook.PublishObjects.Add( _ SourceType:=xlSourceRange, _ Filename:="\\Server2\Q1\Stockreport.htm", _ Sheet:="First Quarter", _ Source:="D5:D9", _ HTMLType:=xlHTMLCalc).Publish

See also: