Results 1 to 2 of 2
Thread: Help with WordBasic (W97)
2003-03-14, 14:42 #1
- Join Date
- Mar 2003
- Raleigh, North Carolina, USA
- Thanked 0 Times in 0 Posts
Help with WordBasic (W97)
I'm new to this Macro Stuff and have been tasked with adding a checkbox to an existing template macro (in WordBasic) that will choose a phrase to be printed on the document. The macro puts up a dialog box asking for assorted info to go on the document. A "DO NOT COPY" or "COPY PERMITTED" phrase must be printed on the document, based on the checkbox, at the template's bookmarked location. I'm not having much luck finding examples or help on how this is done. Help!!?? Anyone??!!
2003-03-14, 23:17 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 93 Times in 89 Posts
Re: Help with WordBasic (W97)
WordBasic (Word2-Word95) used a completely different method for laying out Dialogs than Visual Basic for Applications (Word97+). If you can't get your hands on a copy of one of the earlier versions of Word and its dialog box editor, you probably will find it difficult to get the layout exactly right without a lot of manual futzing. Is that an option? If not, is it an option to redesign the form as a VBA UserForm? This will take a few hours if you haven't done it before, but will be much easier to maintain going forward.
If you really have no choice but to keep working with the old code, here's a short explanation of what you need to do:
- <LI>Resize your dialog to make room: enlarge the height or width as needed.
Begin Dialog UserDialog [Left, Top,] Width, Height [, strTitle] [, .DialogFunction]
The first two numeric parameters are optional, as are the last two parameters. Left and Width are measured in 1/8 of the system font, while Top and Height are measured in 1/12 of the system font. Or so my book says, as this seems rather wacky. But you probably can judge from your existing code what parameters you need to use to line up your new checkbox.
<LI>Add a checkbox between the Begin Dialog and End Dialog statements (but not in the middle of an OptionGroup!).
CheckBox Left, Top, Width, Height, strLabel, .Identifier
The .Identifier is the string you will use to retrieve the value of the checkbox after the user closes the dialog. For example, if the dialog is declared as dlg, which was common in WordBasic code, and the .Identifier string was .chkNewBox, you would retrieve its value using dlg.chkNewBox. The valid values are 0 for empty and 1 for checked.
As noted above, the numeric parameters are calculated in a unique manner.