How do I get out of the footer?

  • Thread starter Rhonda from Western Australia
  • Start date
R

Rhonda from Western Australia

My knowledge of macros is limited. I found one that fixes a problem I'm
having with Track Changes affecting cross references
(http://www.pcreview.co.uk/forums/thread-3715892.php) that seems to work
really well.

However, after running it I end up in the footer (where there's a field) and
in Draft mode, and I don't know what I have to add to the macro to close the
footer and return me to the Print Layout view and where I was when I ran the
macro.

Here's the macro from that website:

Sub AcceptTrackedFields()
Dim oRange As Word.Range ' All Range objects - includes ranges in the body,
headers, footers & shapes
Dim Fld As Field ' Field Object
With ActiveDocument
' Loop through all range objects and accept tracked changes on fields
For Each oRange In .StoryRanges
Do
For Each Fld In oRange.Fields
Fld.Select
Selection.Range.Revisions.AcceptAll
Next
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
End With
End Sub

What do I need to include to:
* close the footer
* return me to my original location (or even the beginning of the document)
* return to Print Layout view

I'm using Word 2007.

Thanks!
 
M

macropod

Hi Rhonda,

Try inserting the following lines before the end of the macro:

With ActiveWindow
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
Else
.View.Type = wdPrintView
End If
.View.SeekView = wdSeekMainDocument
.View.Type = wdPrintView
End With
 
M

macropod

Hi Rhonda ,

And for a faster version that returns you to the original starting point and view (since you're a sandgroper running 3 hours behind
the rest of Oz):

Sub AcceptTrackedFields()
Dim oRng As Range ' All Range objects - includes ranges in the body, Headers , Footers & Shapes
Dim Fld As Field ' Field Object
Dim oView As Variant ' The original document view
Dim SelRng As Range ' The original selection
' Turn Off Screen Updating
Application.ScreenUpdating = False
With ActiveDocument
oView = ActiveWindow.View.Type
Set SelRng = Selection.Range
' Loop through all range objects and accept tracked changes on fields
For Each oRng In .StoryRanges
Do
For Each Fld In oRng.Fields
Fld.Select
Selection.Range.Revisions.AcceptAll
Next
Set oRng = oRng.NextStoryRange
Loop Until oRng Is Nothing
Next
End With
With ActiveWindow
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
Else
.View.Type = wdPrintView
End If
.View.SeekView = wdSeekMainDocument
.View.Type = oView
SelRng.Select
End With
' Restore Screen Updating
Application.ScreenUpdating = True
End Sub
 
R

Rhonda from Western Australia

Excellent! That worked great for getting me out of the footer and getting
back to Print Layout view. I can live with not being returned to where I was
when I activated the macro.

And thanks so much for writing this macro in the first place. I'm working on
documents that MUST have Track Changes on for government requirements, and
the cross references were causing all sorts of grief that we could only
resolve by accepting all changes -- which was NOT possible in this situation.

--Rhonda

macropod said:
Hi Rhonda,

Try inserting the following lines before the end of the macro:

With ActiveWindow
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
Else
.View.Type = wdPrintView
End If
.View.SeekView = wdSeekMainDocument
.View.Type = wdPrintView
End With

--
Cheers
macropod
[Microsoft MVP - Word]


Rhonda from Western Australia said:
My knowledge of macros is limited. I found one that fixes a problem I'm
having with Track Changes affecting cross references
(http://www.pcreview.co.uk/forums/thread-3715892.php) that seems to work
really well.

However, after running it I end up in the footer (where there's a field) and
in Draft mode, and I don't know what I have to add to the macro to close the
footer and return me to the Print Layout view and where I was when I ran the
macro.

Here's the macro from that website:

Sub AcceptTrackedFields()
Dim oRange As Word.Range ' All Range objects - includes ranges in the body,
headers, footers & shapes
Dim Fld As Field ' Field Object
With ActiveDocument
' Loop through all range objects and accept tracked changes on fields
For Each oRange In .StoryRanges
Do
For Each Fld In oRange.Fields
Fld.Select
Selection.Range.Revisions.AcceptAll
Next
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
End With
End Sub

What do I need to include to:
* close the footer
* return me to my original location (or even the beginning of the document)
* return to Print Layout view

I'm using Word 2007.

Thanks!
 
R

Rhonda from Western Australia

Very very cool! This works even better and doesn't cause the document to have
a little dance while it's accepting the field changes.

And thanks for the 3 hours behind the rest of Oz reference! ;-)

macropod said:
Hi Rhonda ,

And for a faster version that returns you to the original starting point and view (since you're a sandgroper running 3 hours behind
the rest of Oz):

Sub AcceptTrackedFields()
Dim oRng As Range ' All Range objects - includes ranges in the body, Headers , Footers & Shapes
Dim Fld As Field ' Field Object
Dim oView As Variant ' The original document view
Dim SelRng As Range ' The original selection
' Turn Off Screen Updating
Application.ScreenUpdating = False
With ActiveDocument
oView = ActiveWindow.View.Type
Set SelRng = Selection.Range
' Loop through all range objects and accept tracked changes on fields
For Each oRng In .StoryRanges
Do
For Each Fld In oRng.Fields
Fld.Select
Selection.Range.Revisions.AcceptAll
Next
Set oRng = oRng.NextStoryRange
Loop Until oRng Is Nothing
Next
End With
With ActiveWindow
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
Else
.View.Type = wdPrintView
End If
.View.SeekView = wdSeekMainDocument
.View.Type = oView
SelRng.Select
End With
' Restore Screen Updating
Application.ScreenUpdating = True
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


Rhonda from Western Australia said:
My knowledge of macros is limited. I found one that fixes a problem I'm
having with Track Changes affecting cross references
(http://www.pcreview.co.uk/forums/thread-3715892.php) that seems to work
really well.

However, after running it I end up in the footer (where there's a field) and
in Draft mode, and I don't know what I have to add to the macro to close the
footer and return me to the Print Layout view and where I was when I ran the
macro.

Here's the macro from that website:

Sub AcceptTrackedFields()
Dim oRange As Word.Range ' All Range objects - includes ranges in the body,
headers, footers & shapes
Dim Fld As Field ' Field Object
With ActiveDocument
' Loop through all range objects and accept tracked changes on fields
For Each oRange In .StoryRanges
Do
For Each Fld In oRange.Fields
Fld.Select
Selection.Range.Revisions.AcceptAll
Next
Set oRange = oRange.NextStoryRange
Loop Until oRange Is Nothing
Next
End With
End Sub

What do I need to include to:
* close the footer
* return me to my original location (or even the beginning of the document)
* return to Print Layout view

I'm using Word 2007.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top