Microsoft KB Archive/183308

= WD98: On Exit Macro Jump to Unprotected Section Fails =

Article ID: 183308

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Word 98 for Macintosh

-



This article was previously published under Q183308





SYMPTOMS
When you use an On Exit macro for a form field to go to a bookmark in an unprotected section of the document, the insertion point goes to the beginning of the section, not the bookmark location.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Add an additional text box after the form field that you want to cause the jump to your bookmark location. With that text box, assign either of the following Word Visual Basic for Applications procedures as an On Entry procedure: Sub WorkingGoto ActiveDocument.Bookmarks(" ").Select End Sub

-or-

Sub WorkingGoto Selection.Goto What:=wdGotoBookmark, Name:=" " End Sub To make the field less visible set the maximum length to 1, and remove the bookmark name in the Field Options dialog box.

NOTE: These code samples will not work in an On Exit macro when the bookmark is in the unprotected section of the document. If the bookmark is for another form field, then the code will work as an On Exit macro.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.



MORE INFORMATION
When you use the following code, you will not get the results you want, nor will you get an error message in Word. Sub GoToFails ActiveDocument.Goto What:=wdGotoBookmark, Name:="test" End Sub The wdGotoBookmark constant is not supported by the ActiveDocument property and the GoTo method of Word. This code will not move the insertion point or select the range the bookmark defines.

