
Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
Greg Maxey was telling us:
Greg Maxey nous racontait que :
> Sub Frustration()
> ActiveDocument.Bookmarks("Test").Select
[quoted text clipped - 22 lines]
> myRng.Select
> End Sub
Although I do not see the behaviour you describe with
ActiveDocument.Bookmarks("Test").Select (Word 2003 SP2);
just a shot in the dark, have you tried
ActiveDocument.Bookmarks("Test").Range.Select
instead?
<Lightning strikes>
Oh, just realized that your bookmark was in the Header.. Duh!
Selecting something in the header/footer from VBA always "screw up" the
view.
May I ask why you are selecting it instead of just working with the range
object?
I have never seen a case where I had to select stuff in a header as opposed
to just defining a range object.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Greg - 17 Oct 2005 17:57 GMT
JGM,
Well I am not quite ready to reveal the fruits of my grand
discombobulating efforts over the weekend to create a bookmark add-in
;-). Basically I want to use selection so a user can step through a
document view each bookmark.
I have mashed together the following which seems to keep thing is order
;-)
Sub Test()
Dim myRng As Range
Dim oViewOption As Long
oViewOption = 3 'Chage to 1 or 5 or 6 to test other Word2000 view
options
ActiveDocument.Bookmarks("Test1").Select
Set myRng = Selection.Range
Select Case oViewOption
Case 3 'Is = 3 'PrintView
With ActiveWindow
If .View.SplitSpecial <> wdPaneNone Then
.Panes(2).Close
.ActivePane.View.Type = oViewOption
.ActivePane.View.SeekView = wdSeekCurrentPageHeader
myRng.Select
End If
End With
Case 1 'Normal View
With ActiveWindow
If myRng.StoryType = 1 Or 5 Then
If .View.SplitSpecial <> wdPaneNone Then
.Panes(2).Close
End If
.ActivePane.View.Type = oViewOption
myRng.Select
End If
End With
Case 5 'Outline View
With ActiveWindow
If myRng.StoryType = 1 Or 5 Then
If .View.SplitSpecial <> wdPaneNone Then
.Panes(2).Close
End If
If Not myRng.StoryType = 5 Then
.ActivePane.View.Type = oViewOption
myRng.Select
End If
End If
End With
Case 6 'Is = 6 'Web View
With ActiveWindow
If myRng.StoryType = 1 Or 2 Or 3 Then
If .View.SplitSpecial <> wdPaneNone Then
.Panes(2).Close
End If
.ActivePane.View.Type = oViewOption
myRng.Select
End If
End With
Case Else
'Do Nothing
End Select
End Sub