ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Caption control on shapes (https://www.excelbanter.com/excel-discussion-misc-queries/183296-caption-control-shapes.html)

RobN[_2_]

Caption control on shapes
 
Is there any control, through VBA or other, over the text/caption for
shapes?

ie similarly to what the CommandButton1.Caption = "xxx" and
CommandButton1.BackColor = &HFF00& do.

Rob



Ken Johnson

Caption control on shapes
 
On Apr 11, 8:53 am, "RobN" wrote:
Is there any control, through VBA or other, over the text/caption for
shapes?

ie similarly to what the CommandButton1.Caption = "xxx" and
CommandButton1.BackColor = &HFF00& do.

Rob


If the Shape is one that can show text (has a Textframe) then...

With ActiveSheet.Shapes("Oval 1")
.TextFrame.Characters.Text = "xxx"
.TextFrame.Characters(2, 1).Font.Bold = True 'makes 2nd x bold
(Start = 2, Length =1)
.Fill.ForeColor.RGB = RGB(255, 255, 0) 'adds a yellow fill
'.Fill.ForeColor.SchemeColor = 13 'another way of adding the
yellow fill
End With

Ken Johnson

RobN[_2_]

Caption control on shapes
 
Thanks Ken,

But I can't seem to find the name of the shape anywhere in properties, etc.
It certainly contains text, but I presume I need to call it the exact name
within the VBA code.

Any ideas?

Rob

"Ken Johnson" wrote in message
...
On Apr 11, 8:53 am, "RobN" wrote:
Is there any control, through VBA or other, over the text/caption for
shapes?

ie similarly to what the CommandButton1.Caption = "xxx" and
CommandButton1.BackColor = &HFF00& do.

Rob


If the Shape is one that can show text (has a Textframe) then...

With ActiveSheet.Shapes("Oval 1")
.TextFrame.Characters.Text = "xxx"
.TextFrame.Characters(2, 1).Font.Bold = True 'makes 2nd x bold
(Start = 2, Length =1)
.Fill.ForeColor.RGB = RGB(255, 255, 0) 'adds a yellow fill
'.Fill.ForeColor.SchemeColor = 13 'another way of adding the
yellow fill
End With

Ken Johnson




Andy Pope

Caption control on shapes
 
Hi,

When you select the shape it's name should appear in the Name Box, next to
the formula bar.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"RobN" wrote in message
...
Thanks Ken,

But I can't seem to find the name of the shape anywhere in properties,
etc. It certainly contains text, but I presume I need to call it the exact
name within the VBA code.

Any ideas?

Rob

"Ken Johnson" wrote in message
...
On Apr 11, 8:53 am, "RobN" wrote:
Is there any control, through VBA or other, over the text/caption for
shapes?

ie similarly to what the CommandButton1.Caption = "xxx" and
CommandButton1.BackColor = &HFF00& do.

Rob


If the Shape is one that can show text (has a Textframe) then...

With ActiveSheet.Shapes("Oval 1")
.TextFrame.Characters.Text = "xxx"
.TextFrame.Characters(2, 1).Font.Bold = True 'makes 2nd x bold
(Start = 2, Length =1)
.Fill.ForeColor.RGB = RGB(255, 255, 0) 'adds a yellow fill
'.Fill.ForeColor.SchemeColor = 13 'another way of adding the
yellow fill
End With

Ken Johnson





RobN[_2_]

Caption control on shapes
 
Thanks Andy,

I did know that.....or so I thought! What was showing was "Snip Same Side
Corn...", so I thought it wasn't showing the name at all, but when I clicked
into the Name Box it revealed the full name, "Snip Same Side Corner
Rectangle 2".

Rob

"Andy Pope" wrote in message
...
Hi,

When you select the shape it's name should appear in the Name Box, next to
the formula bar.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"RobN" wrote in message
...
Thanks Ken,

But I can't seem to find the name of the shape anywhere in properties,
etc. It certainly contains text, but I presume I need to call it the
exact name within the VBA code.

Any ideas?

Rob

"Ken Johnson" wrote in message
...
On Apr 11, 8:53 am, "RobN" wrote:
Is there any control, through VBA or other, over the text/caption for
shapes?

ie similarly to what the CommandButton1.Caption = "xxx" and
CommandButton1.BackColor = &HFF00& do.

Rob

If the Shape is one that can show text (has a Textframe) then...

With ActiveSheet.Shapes("Oval 1")
.TextFrame.Characters.Text = "xxx"
.TextFrame.Characters(2, 1).Font.Bold = True 'makes 2nd x bold
(Start = 2, Length =1)
.Fill.ForeColor.RGB = RGB(255, 255, 0) 'adds a yellow fill
'.Fill.ForeColor.SchemeColor = 13 'another way of adding the
yellow fill
End With

Ken Johnson








All times are GMT +1. The time now is 01:21 AM.

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