Excel: Determining an Object's ID Number in a Macro

Last reviewed: November 2, 1994
Article ID: Q67481

SUMMARY

When a Microsoft Excel macro creates an object with the function CREATE.OBJECT, the function will return a text string containing the object's ID (for example, "Oval 3"). This ID can be used to select the object in later macro commands or can be used with functions such as GET.OBJECT.

If the object was created by copying and pasting an existing object, no value is returned to the macro. To determine the new object's ID, place a SELECTION statement directly after the PASTE function.

MORE INFORMATION

The following macro determines the value of an object that was copied and pasted from an existing object:

   =SELECT("Oval 3")
   =COPY()
   =PASTE()
   =SELECTION()
   =RETURN()

The macro selects the existing object (Oval 3), copies it, and pastes it, and the SELECTION statement obtains the ID of the object currently selected (after an object is pasted, it is automatically selected).

For more information on the SELECTION statement, see page 214 of the "Microsoft Excel Function Reference" version 3.0 manual.


KBCategory: kbother
KBSubcategory:



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.