Envelope.UpdateDocument 方法 (Word)
使用目前的信封設定,更新文件中的信封。
語法
expression. UpdateDocument
需要 expression。 代表 'Envelope' 物件的變數。
註解
如果您在將信封加入至文件之前使用此屬性,就會發生錯誤。
範例
這則範例會將 Report.doc 中的信封格式化成使用自訂信封大小 (4.5 x 7.5 英吋)。
Sub UpdateEnvelope()
On Error GoTo errhandler
With Documents("Report.doc").Envelope
.DefaultHeight = InchesToPoints(4.5)
.DefaultWidth = InchesToPoints(7.5)
.UpdateDocument
End With
Exit Sub
errhandler:
If Err = 5852 Then _
MsgBox "Report.doc doesn't include an envelope"
End Sub
本範例會將信封加至使用中文件、 使用預先定義的地址。 列程式碼和對向識別標記 (FIM-A) 設定設為 True ,並更新使用中文件中的信封預設信封。
Dim strAddress As String
Dim strReturn As String
strAddress = "Darlene Rudd" & vbCr & "1234 E. Main St." _
& vbCr & "Our Town, WA 98004"
strReturn = "Patricia Reed" & vbCr & "N. 33rd St." _
& vbCr & "Other Town, WA 98040"
ActiveDocument.Envelope.Insert _
Address:=strAddress, ReturnAddress:=strReturn
With ActiveDocument.Envelope
.DefaultPrintBarCode = True
.DefaultPrintFIMA = True
.UpdateDocument
End With
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應