Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default obtaining the name of a button


If you have assigned a macro to a shape - say a button from the form
bar - and you then activate the macro by clicking on the button, doe
anyone know the code to obtain the name of the button you clicked on ?

I think it should be along the lines of:

but_name = Activesheet.shapes.selection.name

but of course that doesn't work

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default obtaining the name of a button

Application.Caller will return the name of the shape that called
the macro. E.g.,

MsgBox Application.Caller


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"jmoffat" wrote in message
...

If you have assigned a macro to a shape - say a button from the

forms
bar - and you then activate the macro by clicking on the

button, does
anyone know the code to obtain the name of the button you

clicked on ?

I think it should be along the lines of:

but_name = Activesheet.shapes.selection.name

but of course that doesn't work.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide

to creating financial statements


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default obtaining the name of a button

but_Name = Application.Caller

--
Regards,
Tom Ogilvy

"jmoffat" wrote in message
...

If you have assigned a macro to a shape - say a button from the forms
bar - and you then activate the macro by clicking on the button, does
anyone know the code to obtain the name of the button you clicked on ?

I think it should be along the lines of:

but_name = Activesheet.shapes.selection.name

but of course that doesn't work.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


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
Problems Obtaining Data ImbImb Excel Discussion (Misc queries) 1 May 26th 09 06:29 PM
Obtaining just the Year out of the date Learning Excel Excel Discussion (Misc queries) 4 May 25th 08 07:09 PM
Obtaining sum for multiple criteria Teri Excel Discussion (Misc queries) 4 November 23rd 05 11:06 PM
Obtaining Max and Min Values with Sumproduct Timmy Mac1 Excel Discussion (Misc queries) 2 October 20th 05 05:33 PM
obtaining data from Access mike Excel Programming 3 October 22nd 03 07:37 PM


All times are GMT +1. The time now is 06:56 AM.

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

About Us

"It's about Microsoft Excel"