![]() |
Finding the name of an object using VB
Say I have just added an object (Oval) into the worksheet. How do I find it's
name that Excel assigned it via VB code? -- Ken |
Finding the name of an object using VB
Hi Ken
Assuming you want the newest object, and that there always is at least one, try Sub test() MsgBox ActiveSheet.DrawingObjects(ActiveSheet.DrawingObje cts.Count).Name End Sub HTH. Best wishes Harald "Ken" skrev i melding ... Say I have just added an object (Oval) into the worksheet. How do I find it's name that Excel assigned it via VB code? -- Ken |
Finding the name of an object using VB
Another way -
MsgBox ActiveSheet.Ovals(ActiveSheet.Ovals.Count).Name Both Harold's & my examples assume the ZOrder has not been changed since the last was added, eg send-to-back the last added or bring-to-front some other. or, as you say you are adding an oval with code Dim shp as Shape Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, 50, 50, 100, 100) MsgBox shp.Name Regards, Peter T "Ken" wrote in message ... Say I have just added an object (Oval) into the worksheet. How do I find it's name that Excel assigned it via VB code? -- Ken |
All times are GMT +1. The time now is 05:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com