Searching for sections for primary footer

R

Rem

Begining with the first section, I need to search through
the sections for the first section that has an odd page
footer (each section is set for different first page and
even and odd page footers). When the first odd page
footer in the document is reached I can stop the search
and perform some actions in that footer.

I can't simply use something like:

With Selection.Sections(1).Footers_(wdHeaderFooterPrimary)

because I am inserting a textbox in the footer, and this
will not allow that because it essentially opens the
footer in normal view, and I need to be in the footer in
print layout view, as in:

ActiveWindow.View.SeekView = wdSeekPrimaryFooter



Thanks for the help
 
J

Jean-Guy Marcil

Rem was telling us:
Rem nous racontait que :
Begining with the first section, I need to search through
the sections for the first section that has an odd page
footer (each section is set for different first page and
even and odd page footers). When the first odd page
footer in the document is reached I can stop the search
and perform some actions in that footer.

I can't simply use something like:

With Selection.Sections(1).Footers_(wdHeaderFooterPrimary)

because I am inserting a textbox in the footer, and this
will not allow that because it essentially opens the
footer in normal view, and I need to be in the footer in
print layout view, as in:

ActiveWindow.View.SeekView = wdSeekPrimaryFooter

Have you tried with ranges? SOmething like:

'_______________________________________
Dim OddFootRge As Range

Set OddFootRge = Selection.Sections(1) _
.Footers(wdHeaderFooterPrimary).Range

With OddFootRge
.Collapse
.InsertAfter "My name is Porthos."
End With
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Guest

This would be fine except that it does not allow me to
insert a textbox, only text.
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
This would be fine except that it does not allow me to
insert a textbox, only text.

Have you tried:

'_______________________________________
Dim OddFootRge As Range
Dim newTextbox As Shape

With Selection.Sections(1).Footers(wdHeaderFooterPrimary)
Set OddFootRge = .Range
OddFootRge.Collapse

Set newTextbox = .Shapes.AddTextbox _
(Orientation:=msoTextOrientationHorizontal, _
Left:=50, Top:=0, Width:=300, Height:=40, _
Anchor:=OddFootRge)
newTextbox.TextFrame.TextRange = "Test"
End With
'_______________________________________

?
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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