fumei
Mon May 05 10:34:20 PDT 2008
Yes. But why would they have to have different styles? Different styles
does not mean different content. You can have different content, but the
same style.
You can do what ever you want (pretty much).
If you have to have different headers - depending on a user choice selected
from a userform - then you can easily put that choice into the header using
AutoText.
In the example below, I made two Autotext entries in the template. HeaderA
and HeaderB. I made them very different, but that DOES NOT MATTER.
I used an InputBox...but that also does not matter. You can just as easily
do it from a userform on Document_New (when you clone a new document from the
template. What matters is you now have a choice.
Dim whatever
whatever = InputBox("A or B")
Select Case whatever
Case "A"
ActiveDocument.AttachedTemplate.AutoTextEntries("HeaderA") _
.Insert _
Where:=ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).
Range, _
RichText:=True
Case "B"
ActiveDocument.AttachedTemplate.AutoTextEntries("HeaderB") _
.Insert _
Where:=ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).
Range, _
RichText:=True
Case Else
MsgBox "Huh"
End Select
Enter "A".....HeaderA gets dumped into the header.
Enter "B".....HeaderB gets dumped into the header.
As it happens, I made HeaderA have an image (a logo), some text, and a PAGE
field, using a style I named whoCares_1
I made HeaderB have text, tabs, and a PAGE field, using a style I named
WhoREALLYcares.
IT DOES NOT MATTER. The code inserts the AutoText as it is, whatever it is.
StevenM wrote:
>"fumei via OfficeKB.com" wrote: << You would be MUCH better off doing as it
>was suggested. Have this as a template. Especially one that uses Styles
>property. >>
>
>Is it possible to have two (or more) headers using a styles property? So
>that if one option is chosen (via a user form) then header "A" can be used,
>and if another option is chosen then header "B" is used?
>
>-Steven Craig Miller
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200805/1