Frequently asked questions for self help.
Knowledge base article 97Automating printing of envelopes
Please note version 4 has a built-in command for envelopes - see Upgrades.
Problem - You've written a letter and now want to print only the address block on an envelope in a single step.
Solution - You need to create an envelope template and a macro to copy the address block. Follow these steps:
1st part - create a new template to match your envelope size:
- Select File/New and select Template
- Select File/Page Setup and pick the envelope size. Depending on the printer driver, check that the orientation is set correctly.
- Select File/Save and call it "NormalEnvelope"
2nd part - create a macro
- Select Tools/Macros. Set the "Macros In:" drop-down to "Application Macros". In the "Macro Name" box, type in a name like "CreateEnvelope". Click the Create button.
- Copy and Paste the following code between the "Sub" and "End Sub" statements:
Dim s, i, n, pn, addstart, addblock, envDoc, TemplateName
s = ""
addstart = -1
pn = 0
For i = 0 To ActiveDocument.Text.Count
n = ActiveDocument.Text.Item(i)
If (addstart = -1) and (n > 48) Then
addstart = i
If (addstart > -1) and (n = 13) and (pn = 13) Then
pn = n
If addstart = -1 Then
MsgBox "Document is blank!"
addblock = ActiveDocument.Text.Mid(addstart, i - 1 - addstart)
Set envDoc = Documents.Add(TemplateName)
envDoc.Text.Insert 0, addblock
If MsgBox("Do you want to print the envelope?", vbOKCancel) = vbOK Then
envDoc.Print 1, 1, 1, False
3rd Part - run the macro
- Click on the New file button
- Type your letter with the address block at the top of the page
- Select Tools/Macros and click on "CreateEnvelope". Tick the "Quick Macro" checkbox and and OK the dialog.
- Now right-click over the letter and select Macros/CreateEnvelope.
When the macro is run next time, skip step 3.