home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
lotus123
/
lotushlp.arc
/
LOTUS2.DOC
< prev
next >
Wrap
Text File
|
1985-05-31
|
16KB
|
397 lines
1-2-3 Macro Tips
Printing Mailing Labels
Printing mailing labels with 1-2-3 is simple if you prepare a
worksheet on which each address is entered as three or more rows
of long labels:
James Wildman
100 34th Street
Oneonta, IM 03312
Unfortunately this does not allow you to exploit 1-2-3's /d
commands (Data Sort and Data Query) to rearrange or extract
addresses by last name, city, state, or other criteria. Storing
addresses in a 1-2-3 database is much more useful for reorgan-
izing the information later:
James Wildman 100 34th Street Oneonta IM 03312
Ted Mayfair RR 1, Box 22 Hickton NN 77330
William Eggleston PO Box 3443 Helmsford FN 29214
Consult the 1-2-3 manual for a discussion on the uses of /ds and
/dq commands.
Assume that your database has been established correctly, with
fields for first name, last name, street address, city, state,
and zip code. Unfortunately these addresses look nothing like
mailing labels. What comes next? Retyping each row to look like
the address in the first example comes to mind, but using the /c
(Copy) command might require less effort. By positioning the cell
pointer on the first field of a record and issuing the /c
command, you can indicate a cell outside the database to be the
target for the copy.
To move each record using the Copy command, the following key-
strokes would be required:
/c <return><right arrow><right arrow><right arrow>
<right arrow><right arrow><right arrow>
<right arrow><return>
Since 1-2-3 leaves the cell pointer on the cell copied from,
copying the rest of the address requires moving the cell pointer
to the next field (the `last name' column), issuing the /c
command, and pointing to the cell into which you want that field
copied.
This method of pointing to a range is inefficient, as previously
named ranges may be supplied to the /c command. Using named
ranges for operations such as copying take a bit more time to
establish initially, but make automating routine tasks much
simpler.
1
Start by creating range names for each cell into which you are
going to copy each field of an address. Assign range names which
represent the information in each area of cells. The cell that
will hold the first name in the formatted address might be named
`first' or `firstname', the cell that will hold the last name
might be named `last' or `lastname', and so on.
Use /rnc (Range Name Create) to name the cells in a block outside
of your database. Now when you issue the /c command and 1-2-3
prompts for the cell to copy to, instead of pointing, type the
range name of the appropriate cell. Using range names is just one
way of making 1-2-3 work harder for you. Your work will be done
faster if you put all of the previously discussed steps into a
macro. Here's a macro named \F which will format an address for
you:
\F /c~FIRST~{right}
/c~LAST~{right}
/c~ADDRESS~{right}
/c~CITY~{right}
/c~STATE~{right}
/c~ZIP~
To invoke the macro, put the cell pointer on the first field of a
record, hold down the <Alt> key, and press the F key.
When the macro has finished, you will have to move the cell
pointer to be able to see the finished product. Use the goto <F5>
key with the range name NAME. The formatted address will look
like this:
James Wildman
100 34th Street
Oneonta IM 03312
If the first name or the city name of the address are particu-
larly long, they will run into the last name or state name when
the address is formatted. Choose the address with the longest
first name or city name to format first, then use /wcs (Worksheet
Column-width Set) to increase the size of the first column until
everything fits. This makes the column wide enough to fit each
address formatted subsequently.
Printing the Formatted Address
Since 1-2-3 normally expects to be printing on eight and a half
by eleven inch pages, it automatically spaces down five lines
before printing the first line of text (unless you have changed
the default settings or have already printed something during
this session using different print options). To print a label
exactly where you want it, start by typing:
/ppoouq (Print Printer Options Other Unformatted Quit)
2
This set of commands instructs 1-2-3 to print without page
breaks, heading space, and footing space. Your text will be
printed beginning on the line where the print-head of your
printer is when you later type g (Go). The Print menu will still
be displayed and you will want to type r (Range) and highlight
the formatted address. Make sure to cover all three columns and
all three rows of the address when marking the range to print.
Check that the printing head of your printer is on the paper
label on the line where you want the typed address to begin.
Finally, type g (Go). 1-2-3 will print the formatted address onto
the address label.
If you wish to format and print another address label, q (Quit)
out of the print menu, position the cell pointer on the first
field of a different record, invoke the macro, adjust the printer
so the print head is on the next label, and type /ppg (Print
Printer Go). Since 1-2-3 remembers all the print settings, when
you format a new label into the same cells as the first, you do
not have to reset the print options.
If you wish to print a number of labels, this procedure becomes
tedious and time consuming. The macro should be rewritten so that
it automatically formats and prints every address in the address
database, or so that it pauses after printing an address,
allowing the user to select which address it will print next.
Here is a macro which formats an address, prints it on a label,
and pauses to select a new address for printing. The cell pointer
should be on the first field of a record when the macro is
invoked, and the print-head should be at the very top of the
address label:
\P /ppoouqrALL~q
LOOP /rncSTART~~
/c~FIRST~{right}
/c~LAST~{right}
/c~ADDRESS~{right}
/c~CITY~{right}
/c~STATE~{right}
/c~ZIP~
{goto}START~
/rndSTART~{down}
/ppgq
{?}
/xgLOOP~
Before you invoke this macro, make sure you have used /rnc (Range
Name Create) to name the cells you will be copying into. Also,
you might have noticed the range name ALL at the beginning of
this macro. This is very important. It is a range of cells that
contains exactly the number of lines which can be printed on each
paper label, and which surrounds the cells into which you are
formatting the address.
3
The above example assumes that you will use tractor fed paper
labels which fit nine lines of text from the beginning of one
label to the beginning of the next.
The range name ALL is assigned to a range covering nine rows of
the worksheet with the formatted address embedded as follows:
A B C D E
1
2
3
4 James Wildman
5 100 34th Street
6 Oneonta IM 03312
7
8
9
10
11
\P is the range name of the macro. A '\P is entered in the cell
to the left of the macro's first cell (Without the single quote
the cell would have been filled with p's. See the label prefix
section of the 1-2-3 manual for an explanation), then issued the
/rnlr command (Range Name Labels Right) to assign this name.
Invoke the macro by holding <Alt> and pressing p.
Let's look at how the macro works:
/ppoouqrALL~q
(Print Printer Options Other Unformatted Quit Range ALL <Return>
Quit) Sets the print mode to unformatted and instructs 1-2-3 to
print the range named ALL when it encounters a /ppg command
(Print Printer Go). This at the beginning of the macro to
establish print settings for the rest of the session. The macro
will be faster if this step is taken only once.
LOOP is the range name of the next line of the macro. This range
name was created in the same manner as the \P range name
described above. This is where the formatting and actual printing
begins and the location to which the macro loops after a label is
printed.
/rncSTART~~
This assigns the range name START to the current cell (the `first
name' cell of the address being formatted). It is used by the
macro as a place-holder. When the address has been formatted, the
cell pointer will be returned to this cell (using {goto}START~),
the range name START will be deleted, the pointer will be moved
down a cell, and the macro will pause until the <return> is
pressed.
4
/c~FIRST~{right}
/c~LAST~{right}
/c~ADDRESS~{right}
/c~CITY~{right}
/c~STATE~{right}
/c~ZIP~
This is the macro developed earlier which formats the address to
be printed.
{goto}START~
This moves the cell pointer back to the first field of the
address as explained above.
/rndSTART~{down}
The range name START is deleted because the macro will reuse it.
Remember that whenever a range name is used that has already been
defined, 1-2-3 offers the old range as the default range to name.
You can avoid having to "back up" when reusing a range name by
deleting the old range name first.
After the range name is deleted, the macro moves the cell pointer
down to the next row. This is for convenience. The user will be
able to choose this address to print next by hitting <return>, or
will be able to select a different address by using the arrow
keys.
/ppgq
The macro is telling 1-2-3 to print (which it does using the
range ALL as explained earlier).
{?}
The macro pauses. The user can stop the macro by pressing
[BREAK], or move the cursor to a different first name cell, or
print the new current address by pressing <return>.
/xgLOOP~
When the user presses <return>, this line causes 1-2-3 to
continue reading keystrokes in the cell named LOOP. LOOP is the
line of the macro in which the range name START is created. You
can see that the macro will repeat its entire routine, pausing
again after it has printed the new address.
Many 1-2-3 users need the ability to automate a mass-mailing,
sending letters to every address in a database. Obviously it is
inconvenient to sit at your computer and press <return> after
each address is printed.
5
The \P macro will be automatic with only slight modification.
These modifications assume that the user will position the cell
pointer on the first cell of a database, invoke the macro, and
ignore the computer until all labels are printed. The automatic
macro will look like this:
\P /ppoouqrALL~q
LOOP /rncSTART~~
/xi((START)=-1)~/xq
/c~FIRST~{right}
/c~LAST~{right}
/c~ADDRESS~{right}
/c~CITY~{right}
/c~STATE~{right}
/c~ZIP~
{goto}START~
/rndSTART~{down}
/ppgq
/xgLOOP~
This macro is different in only two ways: It does not contain the
{?} command (Pause until <return> is pressed), and it has a line
which checks to see if the value of the cell named START is -1:
/xi((START)=-1)~/xq
This line (added right after the cell named LOOP) says, "If the
value of START is -1, quit execution of the macro. Otherwise
continue reading keystrokes in the next cell."
Before running this macro be sure to make one more change to your
worksheet. Go to the row below the last row of your database and
enter a -1 in the first name field. If you run the macro without
having put a -1 at the end of your database, it will continue to
run to the bottom of the worksheet, spewing blank address labels
out of your printer until you stop it by pressing the <Ctrl> and
<Break> keys.
These macros should be useful to anyone who keeps a database of
addresses. With changes in the number of fields to be copied, you
need only to add another range name for a cell within the range
ALL and add another /c~ command to the macro. If your paper
labels are larger or smaller than ours you can modify the
printout by changing the number of rows included in the range
ALL.
6