JeremyS
04-24-2013, 07:36 PM
0
In Word 97, I am trying to hide parts of my document that are in a certain font if the user enters "No" on a Dropdown Box.
I have named the bookmark associated with the Drop Down box "ScheduleKRE"
I have the following VB Macro called Dynamic, but this does not seem to work.
Sub Dynamic()
Dim KRE As Range
Set KRE = ActiveDocument.Bookmarks("ScheduleKRE").Range
If KRE = "No" Then
ActiveDocument.Unprotect
Selection.Find.ClearFormatting
Selection.Find.Font.Color = 5898330
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Hidden = True
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveDocument.Protect (wdAllowOnlyFormFields)
End If
End Sub
Any assistance is really appreciated
In Word 97, I am trying to hide parts of my document that are in a certain font if the user enters "No" on a Dropdown Box.
I have named the bookmark associated with the Drop Down box "ScheduleKRE"
I have the following VB Macro called Dynamic, but this does not seem to work.
Sub Dynamic()
Dim KRE As Range
Set KRE = ActiveDocument.Bookmarks("ScheduleKRE").Range
If KRE = "No" Then
ActiveDocument.Unprotect
Selection.Find.ClearFormatting
Selection.Find.Font.Color = 5898330
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Hidden = True
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveDocument.Protect (wdAllowOnlyFormFields)
End If
End Sub
Any assistance is really appreciated