Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the cell in which an object lies F*SH Charts and Charting in Excel 2 July 19th 06 09:33 AM
Option button object proeprties or object not found in vba Pete Straman S via OfficeKB.com Excel Programming 0 August 31st 05 05:49 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM
trouble finding object to use Wazooli Excel Programming 4 February 22nd 05 01:07 AM
finding the last row populated in an excel object eli silverman Excel Programming 6 January 7th 04 07:09 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"