共用方式為


Application.NewDocument 方法 (Publisher)

會傳回代表新出版物的 Document 物件。

語法

運算式NewDocument (靈, 設計)

expression 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Wizard 選用 PbWizard 用來建立新出版物的精靈。 可以是 Microsoft Publisher 類型程式庫中所宣告的 PbWizard 常數之一。 預設值為 pbWizardNone
設計 選用 Long 套用至新出版物的設計。

傳回值

文件

範例

本範例建立新出版物並編輯主頁面,以便在頁面左上角的星號中包含頁碼。

Sub CreateNewPublication() 
 Dim AppPub As Application 
 Dim DocPub As Document 
 
 Set AppPub = New Publisher.Application 
 Set DocPub = AppPub.NewDocument 
 AppPub.ActiveWindow.Visible = True 
 
 With DocPub.MasterPages(1).Shapes.AddShape _ 
 (Type:=msoShape5pointStar, Left:=36, _ 
 Top:=36, Width:=50, Height:=50) 
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0) 
 With .TextFrame.TextRange 
 .InsertPageNumber 
 .ParagraphFormat.Alignment = pbParagraphAlignmentCenter 
 With .Font 
 .Bold = msoTrue 
 .Color.RGB = RGB(Red:=255, Green:=255, Blue:=255) 
 .Size = 12 
 End With 
 End With 
 End With 
End Sub

支援和意見反應

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