Insert Shape in multiple Headers

K

Kerri

Hi,
I'm working on a vba macro (which will be used with a
UserForm) that will insert a text box in the all headers.
The headers will already have shapes or text located in
them so I do not want that text to be deleted. Basically
I have Different First page and no other sections. So I
want the box to appear in the Different First Page and
Primary Headers. I hope I don't have to create two macros
in order to have the textbox appear in multiple sections.
or do I? I also noticed that if I don't use the If stmt
and only say wdHeaderFooterPrimary, then it will only
insert the textbox on the current page header and I then
have to go to the first page and run the macro again for
that page. ;o(

Well, Headers will be the death of me yet. All
suggestions are welcome and most appreciated!!
Thank you
Kerri

Here is a trimed down version of my macro.

Sub SideAddress()
If ActiveWindow.View.SeekView = wdHeaderFooterPrimary =
True Then
Resume
Else: ActiveWindow.View.SeekView = wdSeekFirstPageHeader
End If

Set Textbox1 = Selection.HeaderFooter.Shapes.AddTextbox
(msoTextOrientationHorizontal, _
18#, 360#, 72#, 72#)

'I left out the formatting of textbox since that wasn't
the issue.

'Insert text into the textbox
Textbox1.Select
With Selection
.TypeText Text:="Name"
.TypeParagraph
.TypeText Text:="Address"
End With

'Activate Main document when finished with header
ActiveWindow.View.SeekView = wdSeekMainDocument
End Sub
 
W

Word Heretic

G'day "Kerri" <[email protected]>,

pass parms to a common routine that uses StoryRanges to place the
insert.


Kerri said:
Hi,
I'm working on a vba macro (which will be used with a
UserForm) that will insert a text box in the all headers.
The headers will already have shapes or text located in
them so I do not want that text to be deleted. Basically
I have Different First page and no other sections. So I
want the box to appear in the Different First Page and
Primary Headers. I hope I don't have to create two macros
in order to have the textbox appear in multiple sections.
or do I? I also noticed that if I don't use the If stmt
and only say wdHeaderFooterPrimary, then it will only
insert the textbox on the current page header and I then
have to go to the first page and run the macro again for
that page. ;o(

Well, Headers will be the death of me yet. All
suggestions are welcome and most appreciated!!
Thank you
Kerri

Here is a trimed down version of my macro.

Sub SideAddress()
If ActiveWindow.View.SeekView = wdHeaderFooterPrimary =
True Then
Resume
Else: ActiveWindow.View.SeekView = wdSeekFirstPageHeader
End If

Set Textbox1 = Selection.HeaderFooter.Shapes.AddTextbox
(msoTextOrientationHorizontal, _
18#, 360#, 72#, 72#)

'I left out the formatting of textbox since that wasn't
the issue.

'Insert text into the textbox
Textbox1.Select
With Selection
.TypeText Text:="Name"
.TypeParagraph
.TypeText Text:="Address"
End With

'Activate Main document when finished with header
ActiveWindow.View.SeekView = wdSeekMainDocument
End Sub

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
K

Kerri Bourland

I was able to get it to work with two separate macros but would prefer a
method that would look cleaner and would be easier to modify in only one
macro.

I'll have to look up story ranges, I have never used them before and I am
unfamiliar with them. I'm not sure what the difference is between ranges
and story ranges but I'll research them before I ask more on this topic.

Thank you for responding.
Kerri
 

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