Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2017 by Barry MacDonnell. All Rights Reserved.

Page updated May 17, 2016
WordPerfect Tips
Main tips page | Browse tips

Filling in forms using WordPerfect

Pages related to "forms" -

How to quickly fill up label or business card sheets with duplicates 

Merge tips 

Page Contents - Filling in forms using WordPerfect

1. Filling in forms originally created in a WordPerfect document

A. Use a borderless table 

A "borderless" table is simply a table with all table and cell border lines turned off. (N.B.: These are not the same things as table gridlines or table guidelines, as explained here.) 

You can, of course use some -- or all -- borders in the table, if your table form calls for them to be visible and print.

Creating a borderless table is easily done: 

  • either put the cursor in a table cell and (1) select the entire table with the Select All Cells button (image) on the table's property bar, then (2) click the Default Line Style button (image) which then appears on the property bar, and choose "X"; 
  • or (1) select the entire table first with your mouse, (2) right-click anywhere on the table, and then (3) choose Borders/Fill from the context menu that appears, and choose "X" as the style for all items. [This method should bring up the Properties for Table Borders/Fill dialog. Any button icon there that contains an "X" means the feature is turned off.]

You can use a borderless multi-cell table with fixed text (or empty "spacer" areas) in locked cells (to lock and unlock cells, see here) in the main document window of the template. Then fill in the variable data in the unlocked cells, load your paper or label stock, and print. 

Note: No watermark image of an actual form is needed, but of course you could use one so the fixed text (or other items on the form) shows up on the same page, layered underneath the table. See, for example, the scanner method below.

The descriptive headings or other fixed information on the form are simply placed inside locked cells; the user then uses the <Tab> (or <Shift><Tab>) key to go to areas where the form's text is needed. [To create locked cells, and unlock them if needed, see the method here.]

If you need a line underneath any text, simply toggle that cell's bottom border "on" by right-clicking the cell and selecting Borders/Fill; under the Cell tab, set the cell's bottom line to a suitable line style. Naturally, all other cell borders typically are set "off" unless you require them for stylistic reasons. (Also see Method E, below, which explains how to use single-border text boxes to produce "underlines.")

Tips:

☼  For more, see Laura Acklen's Creating Forms with Tables (a Corel Tutorial for WordPerfect 12 -- but the information should apply to most other versions).

☼  Consider making a custom template (.WPT) from the table document. This helps protect the form from accidental changes.

☼  For an example or a borderless table used to create a landscape form that can rotate text on Avery (or similar) labels, cards, tags, etc., see here.

Advantages:

As Jim Shackleford said on his Creating Forms web page [unfortunately no longer available], "While table based forms can admittedly be more difficult to set up than non-table forms, tables have several advantages:

  • Users can simply tab through the fields much like a data entry form for a database.
  • If desired, one can obtain and manipulate the data entered into the cells [e.g., via a merge] or even export a table for importation into a database or spreadsheet.
  • [For "underlines" using cell borders:] Unlike graphic lines, table and cell lines will print pretty much the same from printer to printer.
  • [For "underlines" using cell borders:] Text does not "move" when inputting data in a "fill in the blank" form on the PC, unlike lines created by repeatedly pressing the underscore character on the keyboard."

Related items:

  • Splitting cells to customize or equalize the size of certain cells (shows how to split table cells in a particular row so that the resulting cells are equal in width, which sometimes doesn't seem possible in a multi-column table with various column widths)
  • Variable cell widths - How to create some table cells in a table form that have variable widths without changing cells that appear directly above and below that row. [The trick lies in using multiple adjacent ("stacked") one-row tables.]
  • Instead of manually tabbing through cells to insert data you can use (for example) the prompted templatemacro, or keyboard merge method descrbed below to automate the process of inserting data at appropriate locations in the form.

Page Top

B. Use a prompted template 

This method uses WordPerfect bookmarks at specific locations. Using prompted templates is discussed in detail in "Automating WordPerfect Templates," a PDF file that you can read or download on the Tips page under the section, Automating templates (and which is also found inside the author's LetterHd file in the Library).

For some forms this is a bit more elegant than some other methods, since the user sees a dialog window containing all the "fields" on the form itself. (In recent WordPerfect versions you can have up to 64 fill-in fields.)

Some drawbacks: 

  • While the information that you enter in any particular field in the prompt dialog can be used to insert data in several document locations (a "one-to-many" operation), you cannot use "pull-down" or "drop list" menus to choose from among several names or other items ("many-to-one") in the prompt dialog. However, a macro (next method below) can do this.
  • The prompted data is not restricted to a defined section of the document the way using a cell in a borderless table can restrict it (if the table row's properties is set up that way). The inserted data will push subsequent text downward. While this may not be an issue for you, you should be aware of it before designing and creating the prompted template. (You can, of course, use a borderless table in the prompted template to contain/restrict the prompted material to a given location. But a lot of extra information can be "hidden" in the table cell, so be sure to test this method.)

Page Top

C. Use a macro 

[Note that creating a macro with a pop-up dialog to receive, and then use, data input requires knowing how to write macros with the appropriate code. However, even relatively new users might want to explore the simple macros in the Footnotes below.] 

Here, the macro's dialog(s) collects the information you need and then inserts it into appropriate locations in the document.

This is similar to the prompted template method, but it can be more flexible. The macro can be a standalone macro to use on any document that has specific text in it, or it can be a template macro triggered to play when a "form document" based on that template is opened.

  • A simple example of such a macro and its associated form was created by Roy ("lemoto") Lewis, a Corel C_Tech, and is downloadable from his website here (as FakeForm.zip).
  • Another example is shown in Footnote 2, which uses a macro to find and select paired bookmarks and their text placeholders, replacing the placeholders with the desired data.
  • Another, simpler example is shown in Footnote 3. It uses a macro (but without an "input" dialog) to find and select text "fields" (i.e., text placeholders) that were previously typed into the document (e.g., [NAME], [ADDR], etc.).

Page Top

D. Use a keyboard merge

If you plan to fill in the form in one sitting, you can set up the form as a "merge form" with "keyboard stops".

This is a one-choice-to-one-location type of operation. (It is similar to the macro examples mentioned in section 1C above. However, a keyboard merge is a built-in program feature, and it can also prompt the user at each location on the form.)

If you need to enter the same information in multiple locations, consider using an automated prompted template or text variables (text variables were introduced in WordPerfect 10).

[The following applies to WordPerfect 12 and later versions, but the process is very similar in earlier versions.]

Creating the form document

Step 1. To set up your form for a keyboard merge, open the form document, go to Tools, Merge, Form Document button, and select "Create Form Document".

Keyboard merge dialog

In the Data File Source dialog that appears, choose "Use file in active window" then click OK.

Keyboard merge dialog #2

In the Associate Form and Data dialog that appears, choose "No association" and click OK.

Keyboard merge dialog #3

Note: You can combine a normal merge of data from a data source with a keyboard merge. Choose the data file, address book, etc., that you want to associate with the form. (In the form file, click the Go to Data button on the Merge Toolbar to locate the data file you want to use.) Then add normal merge fields and text in the form document that will be filled by WordPerfect during the merge. When finished, add the "stop here" keyboard merge codes as explained in the following paragraphs.

You'll now have a Merge Bar at the top of the document:

Merge bar

Note: If there's a Merge dialog on screen, click Cancel on the dialog to dismiss it.

Step 2. To insert the keyboard "stop here" codes, position your cursor in the document when you want to insert information and click the Insert Merge Code button (on the Merge Bar), then choose Keyboard. Enter some text to prompt you (or the user). It can be a short phrase or several short sentences (maximum = 127 characters).

For example, type "Enter the client's name:" and click OK. You will see a merge command appear in the document at the cursor location that looks like this:

KEYBOARD(Enter the client's name:)

Repeat step 2, using the Insert Merge Code > Keyboard buttons to insert KEYBOARD codes at other locations in the form where you need information to be filled in by the user.

Note: You can force the screen display to show only the local text area, and not hundreds of following characters. This helps you visually locate the area in the document you are entering data into. See the Help (F1) Index tab, "Merge commands" or "Merge codes" for the DISPLAYSTOP code, which provides this option. It can be inserted anywhere in the document, multiple times, with the Insert Merge Code button's "More..." option. Typically it is placed after a line or two of text following a KEYBOARD() command so as to display the local text area.

Step 3. Save the document. Note that it will be given a .FRM filename extension. (When you open it later, the Merge Bar will be visible, ready for you to perform the keyboard merge.)

Using the form document

To produce a filled-in copy of the form, you will do a keyboard merge -- that is, you'll merge the data you input on your keyboard to the on screen form, ultimately creating a copy of the form (now filled in) in a separate document.

Option: You can use a small template macro with a form document set up as a keyboard merge template to load a new document based on that template and then (1) display a message to the user; (2) run the keyboard merge; and (3) display a reminder after the merge is run. See the Footnote 1 below.

Step 4. Open the .FRM document if it is not already open. Click on Merge on the Merge Bar to bring up the Merge dialog. The Form document should be set to "Current Document," the Data Source to "None," and the Output to "New Document."

Step 5. Click on Merge in the Merge dialog. The cursor will move to the first location and a message box will appear with the user's prompt (instructions to the user about what to type, etc.). At that point the cursor should be where it is supposed to be in the document; just type the information appropriate to that location, and move to the next location.

Pressing <Alt+Enter> or clicking the Continue button on the Merge Bar will move you from one keyboard stop (i.e., document location) to the next. If you don't need to enter anything at a particular keyboard stop, click the Continue button or the Skip Next Record button on the Merge Bar, or just press <Alt+Enter>.

Tip: You can assign the Continue function to a keyboard shortcut. From a report on OfficeCommunity.com (thanks to Steve Wise, who got it from Pascal, a Corel employee):

1. Go to menu "Tools"->"Settings"->"Customize"
2. Select the "Keyboards" tab
3. Select the keyboard layout already in use, and click "Edit"
4. Click in the "Choose a shortcut key" list and press F10
5. Select "Tools" in the 'Feature categories' dropdown
6. Select the "End Field" feature and click 'Assign Feature to Key'
7. Click OK, Close, Close.

Step 6. When you have finished entering data (or if you click on Stop or Quit) the cursor will move to end of the new document, which will be a copy of the original with data filled in -- but without the merge codes. Save the document.

Notes and Tips

  • Save as you work. You can save the document anytime during a keyboard merge. Since the Output is of the merge is being sent to the new document currently on screen (not the form document you created in Step 3), the first time you save it you will be asked to give the document a name: note that WordPerfect automatically assigns a .WPD filename extension. Continue with the merge, saving as often as you like.
  • Stop vs. Quit. If you click Stop during the keyboard merge, any remaining text in the merge form will not appear in the new document. Also, if you click Quit, the new document will contain remaining merge codes as well as all text. It probably is better to use Stop to abort the merge, since this should prevent confusing the original merge form (with all its merge codes) with the new, unfinished document.
  • Revisions. If you need to revise your input data, either go back to the original document and Merge from the keyboard again (creating a new filled-in document), or simply edit the filled-in document at the locations that need to be changed. The latter is preferable, of course, but it depends on how easy it is to find the filled-in locations on the form.

Page Top

E. Use single-border text boxes

This method appears complex, but is really very easy to do. It requires that you create new, "floating underlines" with single-border text boxes that are attached to various paragraphs, instead of using underscores (which can be "pushed" aside when data is entered) or some other method of creating underlines (such as graphic lines, which may fail to move if the form is edited). Here's how:

Put the cursor in the paragraph containing the fill-in field. Click on Insert, Text Box. When the new box appears (it will have hatched borders), click anywhere outside it. Then right-click on it to select the box (eight small drag handles should appear around the perimeter of the box). In the context menu that appears at the same time, choose "Wrap," choose "Behind text," then click OK. This allows the fill-in text to appear on top of the box, rather than wrap around it.

The box should still be selected (if not, right-click on it and choose "Select Box"). Right-click on the selected box to bring up the context menu again and choose "Position." Be sure to set the position to "Paragraph" so it will move with the paragraph (i.e., with any text ending with a hard return [HRt]). Click OK.

The box should still be selected, so right-click on it again and choose "Border/Fill." Under the Border tab, in "Available border styles," left-click on the icon with a single bottom border ("Thin bottom" style), then click OK. You now have a rough underline tool.

Finally, with the box still selected, move your cursor over it until it turns to a four-headed arrow, then hold down the left mouse button and drag the box into position on the page where it is to serve as an underline, then release the mouse button. (Notice that a thumb-tack appears during the move to let you know which paragraph the box will be attached to.) You can move the mouse cursor over the right (or left) edge of the box until it turns to a two-headed arrow, then left-click-and-drag the vertical edge to horizontally size the box to your needs.

Now, when you type on the same line as the box, the words you type will appear over the box, which provides the underlined "field."

To make more boxes for your form, just pass the cursor over an existing box, and right-click to select it. Press <Ctrl+C> to copy the selected box to the Windows clipboard. Move to another paragraph if desired. Use <Ctrl+V> to paste the copy into the document (if you haven't moved to another paragraph, it will appear directly on top of the original), right-click on it, then left-click-and-drag the copy into the new position. Repeat to make as many copies as needed, adjusting the width of each box according to the new location's underline requirements.

Caveat: If you print the form on another printer (including faxing it), or print using another version of WP or Windows, the location of the text boxes may shift. See here for some printer problem solutions.

Page Top

2. Filling in pre-printed forms

A. Scanner method

If you frequently use a particular form -- and the form is not on special (or required) paper, or it's not copyrighted -- you can use a scanner to scan the form as a page-size graphic image into WordPerfect and insert it into a watermark. Then use a borderless table in the main document as a sort of "overlay," with all cells locked where you don't want to enter text. The user then needs only to <Tab> to the next unlocked "field" and enter text on the form.

Create a custom template

The best way to do this is to create a new custom template so that users are less likely to modify the original.

Click on File, New from Project (or New in WP8), Options button, Create WP Template. Then create the watermark with Insert, Watermark. You can scan the form into the watermark window (Insert, Graphics, Acquire Image) or, if the file is on disk, use Insert, Graphics, From File. After the form is inside the watermark, set the watermark shading to 100% with the button on the property bar, then close the watermark window (File, Close, or click the right-hand button on the property bar) to return to the main template window. Test print the template document to see if the form prints similarly to the pre-printed form; if not, adjust the size or position of the form's image in the watermark.

Create a borderless table with one or more locked cells

Next, create a borderless table as an overlay in the main document window, with all table cells locked except those that the user must <Tab> to, to enter information.

Tip: You could use a copy of your paper form to draw the table in pencil, then create the table in WordPerfect to match it.

Use Table, Create (or Format, Table in early versions of WordPerfect) and create the table with enough cells to "cover" the form. Drag row and column borders, join cells, split cells, etc., as needed. Then right-click the table and select Border/Fill, then select the Table tab. Set the table default cell lines to <None> and click Apply or OK.

To lock table cells, place your cursor in the cell (or select the range of cells) to be locked with your mouse, then right-click on the cell(s) and choose Format from the menu. This brings up the Properties for Table Format dialog. Under the Cell tab, check the box "Lock cell to prevent changes," then click Apply or OK. Repeat his procedure to lock all cells that should be locked.

Be attentive while you do this. If you lock the wrong cells -- or even the entire table -- you can unlock them with the methods described here.

Finally, go to the Row tab to set row height (a fixed height may work best), row margins, etc. Don't forget to set a font type and size for the table. Save the template. When a new document is opened based on this template it can be filled out and printed.

The advantage of this method is that it saves you from using a pre-printed form each time you print, since you can use ordinary printer paper. This also is a better method if you tend to run out of pre-printed forms: the "forms" are now on your computer. And because of this, you can save the completed form to a convenient folder rather than having to make a physical copy as you would with a pre-printed form. The main disadvantages are in the up-front time it takes to set the form up as a template, and the fact that watermarks are limited to one page, requiring separate scanned images for each page.

Notes and Tips

  • Even though you can create a multipage watermark, WordPerfect will only display the first page of a watermark in the main document window. This makes sense, because watermarks are designed to display on every page of a document, so only the first page of a watermark will show. This small problem can be overcome by using sequential one-page watermarks:
    • Create the first one and close the watermark window. Then enter a hard page break (with <Ctrl+Enter>) in the main document window to create a new page, then create the same watermark (A or B) on the top of that next page with the next page of your form embedded in it. Then exit the watermark window, enter another hard page break, create the next watermark, etc. -- repeating as needed. Each new watermark supercedes the previous one. You can, of course, alternate Watermark A with Watermark B, but you will need to discontinue the last watermark used on the next page to prevent these two flavors of watermark from interfering with each other.
  • It is possible that some text or merged data could push one or more [Watermark] codes downward, causing a problem with the display of the proper watermark images. For a method that solves this problem by hiding the [Watermark] (and other) codes inside the document's initial style code, see this thread on WordPerfect Universe.

Alternatives to this watermark-plus-table overlay method include (1) scanning the image as above, but using either prompts (or a macro) to fill in the form by locating bookmarks (created with Tools, Bookmark) set at specific locations in the main overlay document, or (2) using a macro to get information and then position the cursor on the overlay document with Format, Typesetting, Advance, or (3) using the manual method of using the Shadow Cursor (see View, Shadow Cursor) to move to the desired locations on the overlay document to insert material in the main document.

Using prompted templates is discussed in great detail in "Automating WordPerfect Templates.PDF," which is also found inside the LetterHd archive (.zip) file in the Library. For short forms this may be more elegant, since the user sees a dialog window on screen containing all the fields used on the form itself.

Note that using the Shadow Cursor means that WordPerfect will use hard returns and tabs for page positioning, and the method doesn't restrict text to a given location the way a table cell would. However, it may be useful for your own personal forms where user training or correcting text spillover aren't important issues.

Other methods for filling in scanned forms include using third-party software with form-fill capabilities, such as ScanSoft's PaperPort, Foxit Reader, or PDF-Xchange. The last two are (free) replacements for Adobe PDF Reader.

Page Top

B. FormFill macro method

Download Ron Hirsch's FormFill macro from the Library here. You first take measurements from your pre-printed (single-page) form and tell the macro where to place text (it'll remember these locations). Then load the pre-printed form in the printer tray, and the macro will print the text directly on the form as it passes through the printer.

This method may require a small amount of explanation to new users who wish to set up several new forms, but it has the advantage of not requiring complex table formatting -- you need only take a ruler to your paper form, jot down some measurements, and input them into the macro when asked. The macro then creates a document on disk (the new "form") that is used later by the same macro to fill in information it gets from the user. Its main disadvantage it that it works only with single-page forms.

Page Top

3. Filling in forms originally created with Adobe Acrobat (i.e., "PDF" documents)

A. Using WordPerfect:

Here are some tips from the public Corel WP9 newsgroup:

1. (tbritches) "... Open the form in Adobe Reader. Use the graphics select tool and select the entire form. In WP, choose Insert|watermark. Paste the graphic. Make sure shading is set to 100%. Then you can fill the form in WP. You might have to play with vertical advance or the position of the graphic to get things to line up properly." [Ed.- Also see the tips above (under Preprinted Forms) about using a table or a form-fill macro.]

2. (K.Rodgers) "Some PDF forms allow you to fill them in from within the Adobe Reader. Have you tried double clicking into one of the fields? The catch with filling the form in using Reader is that you can't save the data you filled in, only print it. Adobe does produce a product [Adobe Approval, US$39.00] that is in between the free Reader and the full product [Acrobat]. This allows you to save the filled in form."

B. Using another program:

You may be able to type directly on these PDF forms with Foxit Reader or PDF-Xchange. The last two programs are (free) replacements for Adobe PDF Reader, and include a "typewriter mode" as well as some other mark up tools.

Tip: If the PDF will not let you type on it because of the security settings the originator of the form set up, but you can print the form, you could (1) view that PDF in your default PDF viewer (e.g., Adobe Reader, Foxit, etc.), then (2) print that PDF to a new PDF (instead of to a physical printer) using a low-cost program like PDF995. The resulting second generation PDF should let you fill in the form using Foxit Reader, PDF-Xchange, or similar.

Page Top



Footnote 1

Keyboard merges (see above): You can include the following template macro inside a keyboard merge form set up as a template, associated with the POST NEW trigger. Then, when you click File, New from Project, and select the template, a new form document will be loaded and then it will (1) display a message to the user; (2) run the keyboard merge; and (3) display a reminder after the merge is run.

For more information about automating templates with template macros, see "Automating WordPerfect Templates," which includes instructions on inserting macro code (such as shown below) into templates, associating them with triggers, using a separate "loader" macro that can instantly display the template document, etc.

// Macro code begins -
// KBmerge.wcm - Use this as a Template Macro ONLY

// vHRt inserts a hard return in the Messageboxes -
vHRt:=NToC(0F90Ah)

Messagebox(vAns;"INSTRUCTIONS";
"When you press OK, you will be able to fill in"+vHRt+
"this form document. Messages will appear at the"+vHRt+
"bottom of the screen to help you with each item."+vHRt+vHRt+
"You can move to the next item with <Alt+Enter>"+vHRt+
"or with the Continue button on the new Merge bar"+vHRt+
"that will appear."+vHRt+vHRt+
"Be sure to print the form when you are finished.";
OKCancel!)
If(vAns=2) // (if Cancel)
Close(No!)
Go(End@)
Endif

PosDocVeryTop
// Store the form document's number -
vFormDoc:=?DocNumber

// Run the merge, output to a new document -
MergeRun (
FormFileType: Current!;
DataFileType: NoData!;
OutputFileType: ToNewDoc!)

// Store the merged document number -
vMergedDoc:=?DocNumber
// Switch to the form doc and close it -
SwitchDoc(vFormDoc)
Close(No!)
// Switch back to the merged doc -
SwitchDoc(vMergedDoc)

PosDocTop
Display(On!)
Messagebox(;"REMINDER";
"Be sure to proof-read the document"+vHRt+
"before printing it.")

Label(End@)
Return

Page Top


Footnote 2

Here is a small macro that first finds (and stores in an array) every paired bookmark in the document, then it selects each text placeholder found between the paired [Bookmark] codes and replaces the placeholder with whatever you type into a small pop-up dialog. It repeats until all paired bookmarks have been processed.

To copy the code below into your WordPerfect program, see here.

Important: All bookmarks must be paired bookmarks, not single-code bookmarks. This is usually done by selecting the placeholder text first, then creating the bookmark (enabling the checkbox choice, "Selected Bookmark"). If there are any single-code bookmarks, the macro will simply exit when if comes to one of them. Therefore, be sure to check the Bookmarks dialog (Tools, Bookmark) for existing Bookmarks before adding your own paired Bookmarks.

Here's how it works. Suppose your document has this paired bookmark and text placeholder (shown here in bold):

[Bookmark]NAME[Bookmark]

The macro will stop at the bookmark, highlight the "NAME" placeholder, and replace the placeholder's text with whatever you desire.

You do not need text placeholders (just the paired bookmarks), but this makes it slightly less confusing than not having placeholders since the user can see the placeholder on screen, highlighted and in context.

Tips

☼  During processing the document, if you want to delete a text placeholder and not replace it with anything, simply do not enter anything in the small pop-up dialog. Just press <Enter> to move to the next paired bookmark and placeholder.

☼  You can use the name of the bookmark, not the name of the placeholder, in the pop-up dialog. In the code below, in the GetString() command, replace "ArrayT[x]" with Array[x]". In that case, the text placeholders would not be needed unless you also want visual cues in the document itself (i.e., the placeholders -- if any -- are normally highlighted by the code below).

Note

The GetData() is an obsolete command, but it still works (at least in WPX3). If you get an error the first time the macro is played or edited, simply continue with compiling the macro.

// Macro code begins -
// Adapted from a post by Kenneth Hobson here:
// http://www.wpuniverse.com/vb/showthread.php?postid=26106#post26106

OnCancel(End@)
// delete any QuickMark (single-code Bookmark):
BookmarkDelete ("QuickMark")

// find out how many bookmarks exist:
GetData(vBooknum; Bookmark!; Count!; CurrentDoc!)

IF(vBooknum>0) // make sure there are some bookmarks

Declare Array[vBooknum]
Declare ArrayT[vBooknum]
PosPageTop()
FORNEXT(x; 1; vBooknum)
     GetData(vBookname; Bookmark!; Name!; CurrentDoc!; x) // get name.
     Array[x]=vBookname //Assign bookmark narmes to an array.
     BookMarkBlock(vBookname)
     ArrayT[x]=?SelectedText
     SelectOff
ENDFOR
Display(On!)
FORNEXT(x;1;vBooknum)
     BookMarkBlock(Array[x])
     GetString(Indirect("Var"+x); "Replace: "+ArrayT[x]+NToC(0F90Ah)+NToC(0F90Ah)+"with: ";"Fill in form")
     OnError(GoOn@)
     Type(Indirect("Var"+x))
     Label(GoOn@)
ENDFOR

ELSE
Messagebox(;"Error!";
    "Cannot find any Bookmarks in this document!")

ENDIF
Label(End@)
Return

Page Top


Footnote 3

Here is a simple "looping" macro that finds several text "fields" -- strings of ordinary characters (e.g., [NAME], [ADDR], [TEL]), like the text placeholders in the macro in Footnote 2 above -- that you have previously typed into a document, and then pauses to let you type relevant information at that location (or you can just press <Delete> to remove the field from the document). Then you simply press <Enter> to continue to the next item. When all items are found, a "Finished" message pops up and the macro terminates.

To copy the code below into your WordPerfect program, see here.

Note

You should use text strings (e.g., [NAME]) that are not used for other purposes. Create unique field names such as [**NAME**] or create short field names that tell the user to do something, such as [ENTER NAME HERE]. Then use these text strings in the ForEach command below.

Tips

☼  You can use the same text field name in more than one location in the document, including headers, footers, footnotes, endnotes and text boxes. The macro will process multiple identical field names, one at a time, before it goes on to a different field name.

☼  Instead of using Pausekey(Enter!), you can use the GetString() and/or GetNumber() PerfectScript commands, along with Type() commands to insert the material into the document. This approach was used in a macro posted on WordPerfect Universe here. (The GetNumber() commands were used to add two user-input numbers before inserting the total.)

// Macro code begins -
pExitSubstructures () // (exit from any header, footer, footnote, text box, etc.)
MatchSelection // (when found, select the item)
// Note the last item is NOT followed by a semicolon:
ForEach (i; {"[NAME]"; "[ADDR]"; "[TEL]"})
     PosDocVeryTop
     OnNotFound(GoNextOne)
     Repeat
         SearchString(i)
         SearchNext(Extended!)
         PauseKey(Enter!) // (user should enter text & press <Enter> to continue)
         pExitSubstructures ()
     Until(?NotFound)
     Display(Off!)
     GoNextOne:
EndFor
SelectOff
Display(On!)
Messagebox(;"";"Finished!")
Return

Procedure pExitSubstructures ()
While(?Substructure)
    vSubDoc:=?CurrentSubDoc
    SubstructureExit
    If(vSubDoc=10 or vSubDoc=11) BoxEnd(Save!) EndIf
EndWhile
vBoxType:=?BoxContentType
// If the cursor is in an image or a text box is selected, exit from it:
If(vBoxType=1 or vBoxType=3) BoxEnd(Save!) Endif
EndProc

Page Top