ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Manually changing a picture (shape) name property (https://www.excelbanter.com/excel-discussion-misc-queries/196172-manually-changing-picture-shape-name-property.html)

Ker_01

Manually changing a picture (shape) name property
 
I've got several bitmaps pasted on Sheet1 that I need to refer to in VBA.
However, I'm having trouble figuring out which is which. I'd like to name
each with something easy to remember, but when I bring up the properties tab
(even when the picture is selected) it gives me the worksheet properties and
not the picture properties.

I tried cycling through the images with VBA (thinking I could figure out
which was which and assign names through code) but it is telling me there
are more pictures than actually exist on the sheet, which makes me think
that Excel considers the extra pictures I deleted to still be present- which
makes it even harder to figure out which are which.

So, can anyone tell me how to find and change the name property of a
shape/picture?

Thanks!
Keith



ExcelBanter AI

Answer: Manually changing a picture (shape) name property
 
Hi Keith,

To change the name property of a shape or picture in Excel, you can follow these steps:
  1. Select the shape or picture that you want to rename.
  2. Go to the "Format" tab in the ribbon.
  3. Click on the "Selection Pane" button in the "Arrange" group. This will open the "Selection Pane" on the right-hand side of the screen.
  4. In the "Selection Pane", you should see a list of all the shapes and pictures on your worksheet. Find the one you want to rename and click on its name.
  5. The name should become editable. Simply type in the new name you want to give it and press Enter.

Alternatively, you can also rename a shape or picture using VBA code. Here's an example:

Formula:

Sub RenameShape()
    
Dim shp As Shape
    Set shp 
ActiveSheet.Shapes("Picture 1"'replace "Picture 1" with the current name of your shape or picture
    shp.Name = "New Name" '
replace "New Name" with the name you want to give it
End Sub 

Hope this helps!

Gary''s Student

Manually changing a picture (shape) name property
 
The first loop list the old names. The second loop assigns new names:

Sub Macro1()
newname = Array("Alpha", "Beta", "Gamma")
Dim sh As Shape

For Each sh In ActiveSheet.Shapes
MsgBox (sh.Name)
Next

For i = 0 To 2
ActiveSheet.Shapes(i + 1).Name = newname(i)
Next
End Sub
--
Gary''s Student - gsnu2007j


"ker_01" wrote:

I've got several bitmaps pasted on Sheet1 that I need to refer to in VBA.
However, I'm having trouble figuring out which is which. I'd like to name
each with something easy to remember, but when I bring up the properties tab
(even when the picture is selected) it gives me the worksheet properties and
not the picture properties.

I tried cycling through the images with VBA (thinking I could figure out
which was which and assign names through code) but it is telling me there
are more pictures than actually exist on the sheet, which makes me think
that Excel considers the extra pictures I deleted to still be present- which
makes it even harder to figure out which are which.

So, can anyone tell me how to find and change the name property of a
shape/picture?

Thanks!
Keith




Dave Peterson

Manually changing a picture (shape) name property
 
Manually...

You could select the picture, then look at the namebox (to the left of the
formula bar). You'll see the old name. You can type the new name in that
namebox (and hit enter to confirm your change).



ker_01 wrote:

I've got several bitmaps pasted on Sheet1 that I need to refer to in VBA.
However, I'm having trouble figuring out which is which. I'd like to name
each with something easy to remember, but when I bring up the properties tab
(even when the picture is selected) it gives me the worksheet properties and
not the picture properties.

I tried cycling through the images with VBA (thinking I could figure out
which was which and assign names through code) but it is telling me there
are more pictures than actually exist on the sheet, which makes me think
that Excel considers the extra pictures I deleted to still be present- which
makes it even harder to figure out which are which.

So, can anyone tell me how to find and change the name property of a
shape/picture?

Thanks!
Keith


--

Dave Peterson

Ker_01

Manually changing a picture (shape) name property
 
Wow, that's cool. I wonder how I never learned that before.
Many thanks!
Keith

"Dave Peterson" wrote in message
...
Manually...

You could select the picture, then look at the namebox (to the left of the
formula bar). You'll see the old name. You can type the new name in that
namebox (and hit enter to confirm your change).



ker_01 wrote:

I've got several bitmaps pasted on Sheet1 that I need to refer to in VBA.
However, I'm having trouble figuring out which is which. I'd like to name
each with something easy to remember, but when I bring up the properties
tab
(even when the picture is selected) it gives me the worksheet properties
and
not the picture properties.

I tried cycling through the images with VBA (thinking I could figure out
which was which and assign names through code) but it is telling me there
are more pictures than actually exist on the sheet, which makes me think
that Excel considers the extra pictures I deleted to still be present-
which
makes it even harder to figure out which are which.

So, can anyone tell me how to find and change the name property of a
shape/picture?

Thanks!
Keith


--

Dave Peterson





All times are GMT +1. The time now is 09:25 AM.

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