Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Font formatting inside a comment box 1

Status
Not open for further replies.

AcousticalConsultant

Technical User
Sep 20, 2001
45
0
0
CA
Hello,

I was wondering if anyone knew how to format text (e.g. make bold) within a comment box in Excel using VBA. I want to make certain portions of the text bold.

It's easy to do manually, but with the "Macro recorder" it doesn't write any code for the formatting.

Unlike the 'cells' member, the 'comments' member doesn't have a 'characters' property to allow one to format part of the text.

I would appreciate any insight.
Thanks!
AC
 
Hi AC

You need to access the comment as a shape..

Dim myCom As Comment
Set myCom = ActiveCell.AddComment
myCom.Text "Hello This is my comment right here"
myCom.Shape.TextFrame.Characters(1, 10).Font.Bold = True

With 1 being the first character you want Bold and 10 being the length you want to make bold

Hope this helps!

sugarflux
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top