Populate the Header/Footer from a drop-down box selection

L

ladygeek0_0

Hi - not sure if it is possible to do this, but if so it would be very
useful!

I have created a document which will need the sensitivity level set on
an ad-hoc basis. I've put a drop-down box in the document where the
user will select the level of sensitivity of the document and I'd like
to be able to have the Header/Footer section populated from the user
selection - so if the user selects the level "VERY SECRET" from the
box, the header and footer will automagically update to "VERY SECRET"
as well.

Can this be done?

Thanks
 
G

Greg Maxey

The dropdown has a bookmark name (e.g., Dropdown1). Change it to something
meaningful like "Sensitivity" and then place a REF field in the Header {REF
Sensitivity} run a macro OnExit from the dropdown formfield something like
this (probably a little over kill for this specific purpose but it will
work):

Sub UpdateAllFields()
Dim rngStory As Word.Range
Dim lngJunk As Long
Dim oShp As Shape
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
For Each rngStory In ActiveDocument.StoryRanges
'Iterate through all linked stories
Do
On Error Resume Next
rngStory.Fields.Update
Select Case rngStory.StoryType
Case 6, 7, 8, 9, 10, 11
If rngStory.ShapeRange.Count > 0 Then
For Each oShp In rngStory.ShapeRange
If oShp.TextFrame.HasText Then
oShp.TextFrame.TextRange.Fields.Update
End If
Next
End If
Case Else
'Do Nothing
End Select
On Error GoTo 0
'Get next linked story (if any)
Set rngStory = rngStory.NextStoryRange
Loop Until rngStory Is Nothing
Next
End Sub


Hi - not sure if it is possible to do this, but if so it would be very
useful!

I have created a document which will need the sensitivity level set on
an ad-hoc basis. I've put a drop-down box in the document where the
user will select the level of sensitivity of the document and I'd like
to be able to have the Header/Footer section populated from the user
selection - so if the user selects the level "VERY SECRET" from the
box, the header and footer will automagically update to "VERY SECRET"
as well.

Can this be done?

Thanks

--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR
 

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