AutoRepublish Property

Microsoft Excel Visual Basic

expression.AutoRepublish

expression    Required. An expression that returns a PublishObject object.

Example

This example publishes a range on a worksheet to an HTML file on the C: drive. When the user saves the workbook containing the worksheet, Excel will automatically republish the range to the same HTML file. This example assumes that the user has read/write access to the web page and that cells A1 through D10 in the worksheet have values in them.

Sub PublishToWeb()

    With ActiveWorkbook.PublishObjects.Add( _
        SourceType:= xlSourceRange, _
        Filename:="C:\Work.htm", _
        Sheet:="Sheet1", _
        Source:="A1:D10", _
        HtmlType:=xlHtmlStatic, _
        DivID:="Book1.xls_130489")
        .Publish
        .AutoRepublish = True
    End With

End Sub