WD: Variable Assigned to Comments Field Limited to 127 Character

ID: Q73209

The information in this article applies to:

SYMPTOMS

If you assign a string variable to the value of the comment field by dimensioning the EditSummaryInfo dialog box in a Microsoft Word for Windows macro, you can only retrieve the first 127 characters from the Comments field.

STATUS

Microsoft has confirmed this to be a problem in the versions of Microsoft Word for Windows listed above. This problem was corrected in Word version 6.0 for Windows.

To obtain pre-sales information about new or updated Microsoft products, call the Microsoft Sales Information Center at (800) 426-9400. If you are outside the United States, contact the Microsoft subsidiary for your area. To locate your subsidiary, see the Microsoft World Wide Offices Web site at:

   http://www.microsoft.com/worldwide/default.htm

MORE INFORMATION

The Comments field in the Summary Info dialog box can hold up to 256 characters. However, if you assign a string variable to the value of the Comments field (as in the following macro), only the first 127 characters are assigned.

Word for Windows versions 1.0, 1.1 and 1.1a

Sub MAIN
Dim dlg as EditSummaryInfo GetCurValues dlg A$ = dlg.Comment
End Sub

Sub MAIN
DIM dlg as FileSummaryInfo GetCurValues dlg A$=dlg.Comment
End Sub

If you run this macro, A$ only contains the first 127 characters of the information in the document's Comments field.

Workaround

You can extract more than the first 127 characters from the Comments field with the following macro:

Sub MAIN
EndOfDocument InsertField "comments" CharLeft 1,1 UpdateFields Dim dlg as ViewPreferences GetCurValues dlg If dlg.ShowAll Then Super ShowAll ViewFieldCodes 0 A$=Selection$() EditClear
End Sub

This macro moves the insertion point to the end of the document and inserts the {comments} field code. Once inserted, it is highlighted, updated to the current value, stored in A$, and removed from the document. So that A$ is assigned the result of the {comments} field instead the name of the field itself, the macro also clears the Show All and Field Codes options to ensure that the result of the field is displayed rather than the field code itself.

REFERENCES

"Microsoft Word for Windows and OS/2 Technical Reference," pages 163-164

Kbcategory: kbusage kbmacro KBSubcategory:

Additional query words:   1.0 1.0 1.10 1.1 1.1a winword2 word6
winword 1.10a 2.0 2.0
 fixlist6.0
Version           : 1.x 2.0 2.0a 2.0b 2.0c
Platform          : WINDOWS

Last Reviewed: January 30, 1998