WD: Macros to Determine If Line or Document Is EmptyLast reviewed: February 17, 1998Article ID: Q97435 |
The information in this article applies to:
SUMMARYWhen you write a Wordbasic macro, you may need to know whether or not the insertion point is positioned within an empty document or a blank document line. The sample macros in this article determine if the current line or document is empty and then display a message regarding the current status.
MORE INFORMATIONThe following macro commands use the Len() function to determine the character length of the current document line. The contents of the current line is captured using the reserved "\Line" bookmark. If the line length is one character, the line is considered blank or empty. A paragraph return is character 13 and a new line character is character 11 in Word 6.x. Word 6.x-7.x
Sub MAIN 'Is the document line blank? If Len(GetBookmark$("\Line")) <= 1 Then Print "Blank Line" End SubThe following macro commands use the EmptyBookmark statement to determine if the reserved "\Doc" bookmark contains text. If the bookmark is empty, there is no text in the document.
Sub MAIN 'Is the document empty? If EmptyBookmark("\Doc") Then Print "Empty Document" End Sub Word 2.x
Sub MAIN 'Is the document line blank? If Len(GetBookmark$("\Line")) <= 2 Then Print "Blank Line" End Sub REFERENCES"Using WordBasic" by WexTech Systems, Inc. and Microsoft Corporation, Microsoft Press, pages 88-90.
|
Additional query words: blank doc special bookmark Getbookmark
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |