RunLetterWizard 方法

       

在指定的文档中运行信函向导。

expression.RunLetterWizard(LetterContent, WizardMode)

expression   必需。该表达式返回“应用于”列表中的一个对象。

LetterContent   Variant 类型,可选,LetterContent 对象。LetterContent 对象中添入的任何特性都在“英文信函向导”对话框中作为预定义元素显示。如果忽略此参数,GetLetterContent 方法自动从指定文档获得 LetterContent 对象。

WizardMode   Variant 类型,可选。此参数为 True 时,“英文信函向导”对话框显示为带“下一步”、“上一步”、“完成”按钮的分步形式。此参数为 False 时,“英文信函向导”显示为从“工具”菜单中打开的状态,即带“确定”和“取消”按钮的属性对话框。默认值为 True

说明

使用 CreateLetterContent 方法返回 LetterContent 对象,该对象给出各种信函元素的属性。使用 GetLetterContent 方法返回基于指定文档内容的 LetterContent 对象。可以使用 LetterContent 对象的 RunLetterWizard 方法预先设置“英文信函向导”对话框中的元素。

示例

本示例创建一个新的 LetterContent 对象并设置该对象的若干属性,再使用 RunLetterWizard 方法运行信函向导。

Set myContent = New LetterContent
With myContent
    .Salutation ="Hello"
    .SalutationType = wdSalutationOther
    .SenderName = Application.UserName
    .SenderInitials =Application.UserInitials
End With
Documents.Add.RunLetterWizard _
    LetterContent:=myContent, WizardMode:=True

下面的示例使用 CreateLetterContent 方法在活动文档中创建一个新的 LetterContent 对象,再使用该对象的 RunLetterWizard 方法。

Set myLetter = ActiveDocument _
    .CreateLetterContent(DateFormat:="July 31, 1999", _
    IncludeHeaderFooter:=False, _
    PageDesign:="C:\MSOffice\Templates" _
    & "\Letters & Faxes\Contemporary Letter.dot", _
    LetterStyle:=wdFullBlock, Letterhead:=True, _
    LetterheadLocation:=wdLetterTop, _
    LetterheadSize:=InchesToPoints(1.5), _
    RecipientName:="Dave Edson", _
    RecipientAddress:="436 SE Main St." _
    & vbCr & "Bellevue, WA 98004", _
    Salutation:="Dear Dave,", _
    SalutationType:=wdSalutationInformal, _
    RecipientReference:="", MailingInstructions:="", _
    AttentionLine:="", Subject:="End of year report", _
    CCList:="", ReturnAddress:="", SenderName:="", _
    Closing:="Sincerely yours,", SenderCompany:="", _
    SenderJobTitle:="", SenderInitials:="", _
    EnclosureNumber:=0)
ActiveDocument.RunLetterWizard LetterContent:=myLetter