다음을 통해 공유


PublishObjects.Add Method (Excel)

Creates an object that represents an item in a document saved to a Web page. Such objects facilitate subsequent updates to the Web page while automated changes are being made to the document in Microsoft Excel. Returns a PublishObject object.

Syntax

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

A variable that represents a PublishObjects object.

Parameters

Name

Required/Optional

Data Type

Description

SourceType

필수

XlSourceType

The source type.

Title

선택

Variant

String. The URL (on the intranet or the Web) or path (local or network) to which the source object was saved.

Sheet

선택

Variant

The name of the worksheet that was saved as a Web page.

Source

선택

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

선택

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 XlHTMLType constants: xlHtmlCalc, xlHtmlChart, xlHtmlList, or xlHtmlStatic.

DivID

선택

Variant

The unique identifier used in the HTML DIV tag to identify the item on the Web page.

Title

선택

Variant

The title of the Web page.

Return Value

A PublishObject object that represents the new item.

Example

This example saves the range D5:D9 on the First Quarter worksheet in the active workbook to a Web page called Stockreport.htm.

With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceRange, _ 
    Filename:="\\Server\Stockreport.htm", Sheet:="First Quarter", Source:="$G$3:$H$6", _ 
    HtmlType:=xlHtmlStatic, DivID:="Book1_4170") 
        .Publish (True) 
        .AutoRepublish = False 
End With

참고 항목

개념

PublishObjects Object Members

PublishObjects Object