View changes when selecting a range

  • Thread starter Thread starter SWT
  • Start date Start date
S

SWT

I'm having trouble with the Word view type changing upon selecting a range.
To be more specific, I'm working with footers, and when I set a range in the
footer and select it, the word.ActiveWindow.View.Type changes and also opens
up a little footer window. Here is the code I use to solve this problem...


Dim view As Word.WdViewType
Set view = Word.ActiveWindow.ActivePane.View.Type

range.Select

Set Word.Selection.Style = Word.ActiveDocument.Styles "Normal"

Word.ActiveWindow.ActivePane.Close
Set Word.ActiveWindow.ActivePane.View.Type = view



What I am looking to do is either find out a way to not allow the view type
to change upon selecting a range, or to not allow Word to update the view
type change right away. The reason why I need this is because I go through
10+ footers, some with different first pages, and it has to run this code for
each footer range.

Thanks for the help in advance
 
You seem to be trying to apply the normal style to all the footers in a
document in which case

Dim oRng As Range
Dim oSection As Section
Dim oFooter As HeaderFooter
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
Set oRng = oFooter.Range
oRng.Style = "Normal"
End If
Next oFooter
Next oSection

should do the trick

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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

Back
Top