PublishObject 属性 (Excel)PublishObject.AutoRepublish property (Excel)

保存工作簿时, Microsoft Excel 将确定**PublishObjects** 集合中的任何项目是否将 "自动重新发布" 属性设置为True, 如果是, 请重新发布它。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. 默认值为 FalseThe default value is False. 读/写 BooleanRead/write Boolean.



_表达式_一个代表**PublishObject** 对象的变量。expression A variable that represents a PublishObject object.


本示例将工作表上的区域发布到 C:\ 上的 HTML 文件中。驱动器.This example publishes a range on a worksheet to an HTML file on the C:\ drive. 当用户保存包含该工作表的工作簿时,Excel 将自动地将区域重新发布到相同的 HTML 文件中。When the user saves the workbook containing the worksheet, Excel will automatically republish the range to the same HTML file. 本示例假定用户对网页具有读/写访问权限, 并且工作表上的单元格 A1 到 D10 中有值。This example assumes that the user has read/write access to the webpage and that cells A1 through D10 on 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, _ 
 .AutoRepublish = True 
 End With 
End Sub

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.