Klaus-- Word 2003, Windows XP. I have several routines that would leave the
user in a different place than where he started, which is annoying. So I
plant a bookmark, TempBkmk, and return to it. Below is one of the shortest of
these, which toggles showing and hiding the field codes. As I say, this works
at least half the time, but I don't see what makes it fail.
Sub ToggleShowFields()
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="TempBkmk"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.GoTo What:=wdGoToBookmark, Name:="TempBkmk" ' Return to
original location
End Sub
--
Christopher Brewster
Lockheed Martin, Eagan MN
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200811/1