AutoRepublish Property

Microsoft Excel Visual Basic

AutoRepublish Property

       

When a workbook is saved, Microsoft Excel determines if any item in the PublishObjects collection has the AutoRepublish property set to True and, if so republishes it. The default value is False. Read/write Boolean.

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 drive C. 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