CreateLetterContent Method

Microsoft Word Visual Basic

CreateLetterContent Method

       

Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.

expression.CreateLetterContent(DateFormat, IncludeHeaderFooter, PageDesign, LetterStyle, Letterhead, LetterheadLocation, LetterheadSize, RecipientName, RecipientAddress, Salutation, SalutationType, RecipientReference, MailingInstructions, AttentionLine, Subject, CCList, ReturnAddress, SenderName, Closing, SenderCompany, SenderJobTitle, SenderInitials, EnclosureNumber, InfoBlock, RecipientCode, RecipientGender, ReturnAddressShortForm, SenderCity, SenderCode, SenderGender, SenderReference)

expression   Required. An expression that returns one of the objects in the Applies To list.

DateFormat  Required String. The date for the letter.

IncludeHeaderFooter  Required Boolean. True to include the header and footer from the page design template.

PageDesign  Required String. The name of the template attached to the document.

LetterStyle  Required WdLetterStyle. The document layout.

WdLetterStyle can be one of these WdLetterStyle constants.
wdFullBlock
wdModifiedBlock
wdSemiBlock

Letterhead  Required Boolean. True to reserve space for a preprinted letterhead.

LetterheadLocation  Required WdLetterheadLocation. The location of the preprinted letterhead.

WdLetterheadLocation can be one of these WdLetterheadLocation constants.
wdLetterBottom
wdLetterLeft
wdLetterRight
wdLetterTop

LetterheadSize  Required Single. The amount of space (in points) to be reserved for a preprinted letterhead.

RecipientName  Required String. The name of the person who'll be receiving the letter.

RecipientAddress  Required String. The mailing address of the person who'll be receiving the letter.

Salutation  Required String. The salutation text for the letter.

SalutationType  Required WdSalutationType. The salutation type for the letter.

WdSalutationType can be one of these WdSalutationType constants.
wdSalutationFormal
wdSalutationOther
wdSalutationBusiness
wdSalutationInformal

RecipientReference  Required String. The reference line text for the letter (for example, "In reply to:").

MailingInstructions  Required String. The mailing instruction text for the letter (for example, "Certified Mail").

AttentionLine  Required String. The attention line text for the letter (for example, "Attention:").

Subject  Required String. The subject text for the specified letter.

CCList  Required String. The names of the carbon copy (CC) recipients for the letter.

ReturnAddress  Required String. The text of the return mailing address for the letter.

SenderName  Required String. The name of the person sending the letter.

Closing  Required String. The closing text for the letter.

SenderCompany  Required String. The company name of the person creating the letter.

SenderJobTitle  Required String. The job title of the person creating the letter.

SenderInitials  Required String. The initials of the person creating the letter.

EnclosureNumber  Required Long. The number of enclosures for the letter.

InfoBlock  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

RecipientCode  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

RecipientGender  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

ReturnAddressShortForm  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

SenderCity  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

SenderCode  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

SenderGender  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

SenderReference  Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

Example

The following example uses the CreateLetterContent method to create a new LetterContent object in the active document and then uses this object with the RunLetterWizard method.

Set myLetter = ActiveDocument _
    .CreateLetterContent(DateFormat:="July 31, 1996", _
    IncludeHeaderFooter:=False, PageDesign:="", _
    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