Frequently asked questions for self help.

Please take a quick look at common questions (and answers) in the default list. If you can't find what you're looking for, start off by selecting your Ability Office version and then narrow it down by entering search text and/or category.

Knowledge base article 97

Automating 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:

  1. Select File/New and select Template
  2. Select File/Page Setup and pick the envelope size. Depending on the printer driver, check that the orientation is set correctly.
  3. Select File/Save and call it "NormalEnvelope"

2nd part - create a macro

  1. 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.
  2. 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
  End If

  If (addstart > -1) and (n = 13) and (pn = 13) Then
    Exit For
  End If
  pn = n

If addstart = -1 Then
  MsgBox "Document is blank!"
  Exit Sub
  addblock = ActiveDocument.Text.Mid(addstart, i - 1 - addstart)
End If

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
End If

3rd Part - run the macro

  1. Click on the New file button
  2. Type your letter with the address block at the top of the page
  3. Select Tools/Macros and click on "CreateEnvelope". Tick the "Quick Macro" checkbox and and OK the dialog. 
  4. Now right-click over the letter and select Macros/CreateEnvelope.

When the macro is run next time, skip step 3.