Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Name of button

these are buttons from the forms toolbar?

If you have a macro assigned to that button:

dim myBTN as Button
set myBTN = activesheet(application.caller)
msgbox mybtn.name & "- or - " & application.caller



Agamemnon wrote:

Hi

I have create a macro that put some buttons on a sheet.
As the buttons are created automatically I don't know what names they have.
So I would like to know how I can retrieve eg. in Cell sheet1!A1 the name of
the button I click on?

Can somebody help me out on this one?

Thx


--

Dave Peterson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Name of button

Sorry, it was a typo on my part:

set myBTN = activesheet.buttons(application.caller)

You can get the name directly from application.caller, but by using the myBTN
variable, you can get other stuff, too:

msgbox mybtn.topleftcell.address

for instance.

Tsjaikovski wrote:

I got a the following error on line 1
set myBTN = activesheet(application.caller)

"Object doesn't support this property or method"

Do I have to referene the application.caller somewhere?

Object doesn't support this property or method

"Dave Peterson" wrote:

these are buttons from the forms toolbar?

If you have a macro assigned to that button:

dim myBTN as Button
set myBTN = activesheet(application.caller)
msgbox mybtn.name & "- or - " & application.caller



Agamemnon wrote:

Hi

I have create a macro that put some buttons on a sheet.
As the buttons are created automatically I don't know what names they have.
So I would like to know how I can retrieve eg. in Cell sheet1!A1 the name of
the button I click on?

Can somebody help me out on this one?

Thx


--

Dave Peterson


--

Dave Peterson
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
insert row above button (retrieve position of button) Max Excel Discussion (Misc queries) 3 November 7th 07 06:27 PM
Create floating button based on button click in menu ExcelMonkey Excel Programming 2 October 12th 05 06:43 PM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
Delete a custom button by holding down the ALT key and dragging the button off the toolbar Stephen[_8_] Excel Programming 0 April 4th 04 02:22 PM


All times are GMT +1. The time now is 06:37 PM.

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"