ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   changing a shape font to bold with VB (https://www.excelbanter.com/excel-discussion-misc-queries/218699-changing-shape-font-bold-vbulletin.html)

Brettjg

changing a shape font to bold with VB
 
Hmmmm. There must be a trick to this one. The following code works just fine:

With ActiveSheet.Shapes("TB purchase n")
.Fill.Visible = msoTrue
End With

but this does not work:
With ActiveSheet.Shapes("TB purchase n")
.Font.Bold = True
End With

It seems when I'm working with a font I have to select the shape (which I'd
rather not do). This works:
ActiveSheet.Shapes.Range("TB purchase n").Select
Selection.Font.Bold = True

Could someonr throw some light on this for me please? Regards, Brett.

Bob Phillips[_3_]

changing a shape font to bold with VB
 
Try this

With ActiveSheet.Shapes("TB purchase n")
.TextFrame.Characters.Font.Bold = True
End With


--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hmmmm. There must be a trick to this one. The following code works just
fine:

With ActiveSheet.Shapes("TB purchase n")
.Fill.Visible = msoTrue
End With

but this does not work:
With ActiveSheet.Shapes("TB purchase n")
.Font.Bold = True
End With

It seems when I'm working with a font I have to select the shape (which
I'd
rather not do). This works:
ActiveSheet.Shapes.Range("TB purchase n").Select
Selection.Font.Bold = True

Could someonr throw some light on this for me please? Regards, Brett.




Brettjg

changing a shape font to bold with VB
 
Thanks Bob, that works, but this doesn't:

With ActiveSheet.Shapes.Range(Array("TB purchase 1", "TB purchase 2", "TB
purchase 3", "TB purchase"))
.TextFrame.Characters.Font.Bold = False
.Fill.Visible = msoFalse
End With

and I suspect that you can only use textframe with one shape. Is that right?

"Bob Phillips" wrote:

Try this

With ActiveSheet.Shapes("TB purchase n")
.TextFrame.Characters.Font.Bold = True
End With


--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hmmmm. There must be a trick to this one. The following code works just
fine:

With ActiveSheet.Shapes("TB purchase n")
.Fill.Visible = msoTrue
End With

but this does not work:
With ActiveSheet.Shapes("TB purchase n")
.Font.Bold = True
End With

It seems when I'm working with a font I have to select the shape (which
I'd
rather not do). This works:
ActiveSheet.Shapes.Range("TB purchase n").Select
Selection.Font.Bold = True

Could someonr throw some light on this for me please? Regards, Brett.





Bob Phillips[_3_]

changing a shape font to bold with VB
 
Yes, just iterate the array.

--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Thanks Bob, that works, but this doesn't:

With ActiveSheet.Shapes.Range(Array("TB purchase 1", "TB purchase 2", "TB
purchase 3", "TB purchase"))
.TextFrame.Characters.Font.Bold = False
.Fill.Visible = msoFalse
End With

and I suspect that you can only use textframe with one shape. Is that
right?

"Bob Phillips" wrote:

Try this

With ActiveSheet.Shapes("TB purchase n")
.TextFrame.Characters.Font.Bold = True
End With


--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hmmmm. There must be a trick to this one. The following code works just
fine:

With ActiveSheet.Shapes("TB purchase n")
.Fill.Visible = msoTrue
End With

but this does not work:
With ActiveSheet.Shapes("TB purchase n")
.Font.Bold = True
End With

It seems when I'm working with a font I have to select the shape (which
I'd
rather not do). This works:
ActiveSheet.Shapes.Range("TB purchase n").Select
Selection.Font.Bold = True

Could someonr throw some light on this for me please? Regards, Brett.








All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com