Word) (Application.OrganizerCopy 方法

從來源文件或範本,將指定的自動圖文集項目、工具列、樣式或巨集專案項目複製到目的文件或範本。

語法

運算式OrganizerCopy( _Source_ , _Destination_ , _Name_ , _Object_ )

需要 expression。 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Source 必要 String 含有您想要複製之項目的文件或範本檔案名稱。
Destination 必要 String 您想要將項目複製到其中的文件或範本檔案名稱。
Name 必要 String 您想要複製之自動圖文集項目、工具列、樣式或巨集的名稱。
Object 必要 WdOrganizerObject 您想要複製的項目類型。

範例

這則範例會將附加至使用中文件之範本內的所有自動圖文集項目複製到 Normal 範本。

Dim atEntry As AutoTextEntry 
 
For Each atEntry In _ 
 ActiveDocument.AttachedTemplate.AutoTextEntries 
 Application.OrganizerCopy _ 
 Source:=ActiveDocument.AttachedTemplate.FullName, _ 
 Destination:=NormalTemplate.FullName, Name:=atEntry.Name, _ 
 Object:=wdOrganizerObjectAutoText 
Next atEntry

如果使用中文件內存在名為 "SubText" 的樣式,這則範例就會將此樣式複製到 C:\Templates\Template1.dot。

Dim styleLoop As Style 
 
For Each styleLoop In ActiveDocument.Styles 
 If styleLoop = "SubText" Then 
 Application.OrganizerCopy Source:=ActiveDocument.Name, _ 
 Destination:="C:\Templates\Template1.dot", _ 
 Name:="SubText", _ 
 Object:=wdOrganizerObjectStyles 
 End If 
Next styleLoop

另請參閱

Application 物件

支援和意見反應

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