Publisher) (Document.Close 方法

會關閉目前的出版物,並在其位置上建立新的出版物。

語法

運算式。關閉

運算式 代表 Document 物件的變數。

註解

僅在另一個 Microsoft Publisher 執行個體中開啟的文件物件上使用 Close 方法。 若嘗試在 Publisher 的目前執行個體中關閉使用中的出版物,將導致錯誤。

範例

此範例會在新的 Publisher 執行個體中開啟出版物以進行修改,然後關閉該出版物。 請注意,若要讓此範例運作,您必須取代 FileName 為有效的檔案名稱。

Sub ModifyAnotherPublication() 
 
 ' Create new instance of Publisher. 
 Dim appPub As New Publisher.Application 
 
 ' Open publication. 
 appPub.Open FileName:="FileName" 
 
 ' Put code here to modify the publication as necessary. 
 
 ' Close the publication. 
 appPub.ActiveDocument.Close 
 
 ' Release the other instance of Publisher. 
 Set appPub = Nothing 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。