Microsoft KB Archive/65141

Cannot Assign GetGlossary$ to an Arrayed String Variable PSS ID Number: Q65141 Article last modified on 07-14-1994

1.00 1.10 2.00 2.00a

WINDOWS

Summary:

If you assign the GetGlossary$ statement to an arrayed string variable in a Microsoft Word for Windows WordBasic macro, the string variable is not always recognized.

Microsoft has confirmed this to be a problem in Word for Windows version 1.0. This problem was corrected in versions 1.1, 1.1a, 2.0 and 2.0a.

More Information:

The following set of macros demonstrates this problem:

Formula
Sub MAIN DIM fred(134) End Sub

Main_Macro (in versions 1.0, 1.1 and 1.1a)
Sub MAIN Dim Number$(3) MacroEdit "Formulas"  EditSearch "("  CharRight 1, 0  n = 0  GETNUMBER:  CharRight 1, 1  EditGlossary "tempp", .Define  Number$ (n) = GetGlossary$("tempp", 0)  If Number$ (n) = “)” Then Goto ADPONE EditGlossary “tempp”, .Delete n = n + 1 CharRight 1 Goto GETNUMBER ADPONE: End Sub

In Word for Windows versions 2.0 and 2.0a, the correct Main_Macro to use is as follows:

Main_Macro
Sub MAIN Dim Number$(3) ToolsMacro .Name = "formulas", .Edit  EditFind .Find = "("  CharRight 1, 0  n = 0  GETNUMBER:  CharRight 1, 1 [A EditGlossary "tempp", .Define  Number$ (n) = GetGlossary$("tempp", 0)  If Number$ (n) = “)” Then Goto ADPONE EditGlossary “tempp”, .Delete n = n + 1 CharRight 1 Goto GETNUMBER ADPONE: End Sub

Expected Results
The Main_Macro macro should open the Formulas macro, search for the opening parenthesis [(] character, and move to the right. Next, the macro should take each character and assign it to a “tempp” glossary. Next, Main_Macro should assign each number to an arrayed string variable. If the particular character is a closing parenthesis [)] symbol, the macro should break out and go to the label “ADPONE:”

Actual Results
In Word for Windows version 1.0, the macro goes into an infinite loop because it never sees Number$(3) equal to “).”

Additional reference words: w4wmacro 1.00 1.10 1.10a 2.00 2.00a noupd winword

=
================================================================

Copyright Microsoft Corporation 1994.