|
Visual Basic (VB6 and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Visual Basic Library
This page was last updated on Saturday, November 24, 2001
Public Function blnAtEndOfDocument() As Boolean ' Procedure : blnAtEndOfDocument ' Description: Test the position of the selection cursor ' Copyright: Chris Greaves Inc. ' Inputs: None ' Returns: TRUE if the selection is at the end of the document. ' Assumes: Nothing ' Side Effects: None. ' Tested: By the calls shown below. ' I loved the WordBasic AtEndOfDocument call for purposes of controlling WHILE/WEND loops. ' I got tired of pasting the code from the help file. blnAtEndOfDocument = ((Selection.Type = wdSelectionIP) And (Selection.End = ActiveDocument.Content.End - 1)) 'Sub TESTboolOfDocument() '' Issue Ctrl-End then .... 'MsgBox blnAtEndOfDocument ' TRUE 'MsgBox blnAtStartOfDocument ' FALSE '' Issue a left-arrow key then ... 'MsgBox blnAtEndOfDocument ' FALSE 'MsgBox blnAtStartOfDocument ' FALSE '' Add a new document then ... 'MsgBox blnAtEndOfDocument ' TRUE 'MsgBox blnAtStartOfDocument ' TRUE '' In fact, with a new document .... ' If blnAtEndOfDocument And blnAtStartOfDocument Then MsgBox "document has no content" 'End Sub End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Monday, November 19, 2001 |