Checkbox - Bold Text Macro

B

Brian

I am trying to write a Macro for the following: if a user checks a
checkbox, then the text box text next to the checkbox becomes bold.

I tried the follwing:

Sub CheckBold()

If ActiveDocument.FormFields("Check1").Checkbox.Value = True Then
ActiveDocument.Bookmark("Text1").Font.Bold = True
End If

End Sub

However, this is not doing anything. Do I have to do this in a table?
Any help would be appreciated.

Thanks,

Brian
 
P

Paul Berkowitz

I am trying to write a Macro for the following: if a user checks a
checkbox, then the text box text next to the checkbox becomes bold.

I tried the follwing:

Sub CheckBold()

If ActiveDocument.FormFields("Check1").Checkbox.Value = True Then
ActiveDocument.Bookmark("Text1").Font.Bold = True
End If

End Sub

However, this is not doing anything. Do I have to do this in a table?
Any help would be appreciated.

If you look in the VBE Help, Bookmark object, Properties you won't find a
Font property of Bookmark: it doesn't have one. That's why it's not working.
First you have to get the Range whose Font you want to modify. This should
work (untested):

Sub CheckBold()

If ActiveDocument.FormFields("Check1").Checkbox.Value = True Then
ActiveDocument.Bookmark("Text1").Range.Font.Bold = True
End If

End Sub

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
P

Paul Berkowitz

If you look in the VBE Help, Bookmark object, Properties you won't find a
Font property of Bookmark: it doesn't have one. That's why it's not
working. First you have to get the Range whose Font you want to modify.
This should work (untested):

Sub CheckBold()

If ActiveDocument.FormFields("Check1").Checkbox.Value = True Then
ActiveDocument.Bookmark("Text1").Range.Font.Bold = True
End If

End Sub
I just tested it. You (and I) had another error. You need to specify the
particular Bookmark - like a member of any Collection - by the Collection
object's index - Bookmarks("Text1"). Bookmarks must be plural. This actually
works ;-) (tested):



Sub CheckBold()

If ActiveDocument.FormFields("Check1").Checkbox.Value = True Then
ActiveDocument.Bookmarks("Text1").Range.Font.Bold = True
End If

End Sub


--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
B

Brian

Paul Berkowitz said:
I just tested it. You (and I) had another error. You need to specify the
particular Bookmark - like a member of any Collection - by the Collection
object's index - Bookmarks("Text1"). Bookmarks must be plural. This actually
works ;-) (tested):



Sub CheckBold()

If ActiveDocument.FormFields("Check1").Checkbox.Value = True Then
ActiveDocument.Bookmarks("Text1").Range.Font.Bold = True
End If

End Sub


--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.



Perfect! Thank you very much.

B
 

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