Re: Hidden Text Using Checkbox by Dave
Dave
Wed Jul 27 19:12:03 CDT 2005
Thanks Doug!! I should have elaborated.
When this macro is ran, the font does not change to hidden.
Seems like the problem is this line of code:
Set vCheck1 = ActiveDocument.FormFields("chk1A").Range
When I add a break to the code following this line, the value of vCheck is
neither True or False. I'm new to the word programming, should I not have
this macro run on exit?
"Doug Robbins" wrote:
> You don't say what doesn't work any more. Maybe the problem is with the
> settings under Tools>Options>View or Tools>Options>Print which are what
> control the display/printing of hidden text.
>
> I don't see anything wrong with your code, but better to use
>
> ActiveDocument.Bookmarks("bk1A").Range.Font.Hidden = True
>
> as it does not require the movement of the insertion point.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
> "Dave" <Dave@discussions.microsoft.com> wrote in message
> news:DE3CDA38-DCB0-4884-92B9-B025A3B210E1@microsoft.com...
> > Hello,
> > I'm trying to write a macro that will toggle text in a bookmark between
> > hidden and unhidden using a checkbox. I still need the text visible on
> > screen, but I just don't want the text to print. I managed to make it work
> > one time, but something must have gone wrong in my code. Does anyone have
> > a
> > better suggestion or can spot what I'm doing wrong. My macro is below.
> >
> > Sub mcr1A()
> >
> > ActiveDocument.Unprotect Password:=""
> >
> > Set vCheck1 = ActiveDocument.FormFields("chk1A").Range
> >
> > If vCheck1 = False Then
> > ActiveDocument.Bookmarks("bk1A").Select
> > With Selection.Font
> > .Hidden = True
> > End With
> > End If
> >
> > ActiveDocument.Protect Password:="", NoReset:=True, Type:= _
> > wdAllowOnlyFormFields
> >
> > End Sub
> >
> >
> >
>
>
>