FAQ

Domande frequenti per l'auto-aiuto.

Si prega di dare una rapida occhiata alle domande (e risposte) comuni nell'elenco predefinito. Se non riesci a trovare quello che stai cercando, inizia selezionando la tua versione di Ability Office e poi restringila inserendo il testo di ricerca e/o la categoria.

Articolo della base di conoscenza 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

TemplateName="NormalEnvelope"

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
Next

If addstart = -1 Then
  MsgBox "Document is blank!"
  Exit Sub
Else
  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.