#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Buttons

Hi,
XL2003
I have some buttons on the Worksheet (from the Forms toolbar) which fire
specific macros.
Can VBA return (to a variable) the text of the button that fired it?
Regards - Dave.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Buttons

Application.Caller will give you the name of the button.

You can get the text using the name.

Tim

"Dave" wrote in message
...
Hi,
XL2003
I have some buttons on the Worksheet (from the Forms toolbar) which fire
specific macros.
Can VBA return (to a variable) the text of the button that fired it?
Regards - Dave.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Buttons

Hi Tim,
Thanks for your help. But still stuck.
I have:

A = Application.Caller
B = ActiveSheet.Shapes(A).Characters.Text

The first line is working.
But the second line gives an error. Can you please point me to the right
syntax?
Regards - Dave.

"Tim Williams" wrote:

Application.Caller will give you the name of the button.

You can get the text using the name.

Tim

"Dave" wrote in message
...
Hi,
XL2003
I have some buttons on the Worksheet (from the Forms toolbar) which fire
specific macros.
Can VBA return (to a variable) the text of the button that fired it?
Regards - Dave.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Buttons

see if this works for you.

A = Application.Caller
b = ActiveSheet.Buttons(A).Characters.Text
--
jb


"Dave" wrote:

Hi Tim,
Thanks for your help. But still stuck.
I have:

A = Application.Caller
B = ActiveSheet.Shapes(A).Characters.Text

The first line is working.
But the second line gives an error. Can you please point me to the right
syntax?
Regards - Dave.

"Tim Williams" wrote:

Application.Caller will give you the name of the button.

You can get the text using the name.

Tim

"Dave" wrote in message
...
Hi,
XL2003
I have some buttons on the Worksheet (from the Forms toolbar) which fire
specific macros.
Can VBA return (to a variable) the text of the button that fired it?
Regards - Dave.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Buttons

Hi John,
Thanks! When I modified the button with the macro recorder turned on, the
syntax used 'Shapes', But 'Buttons' works and Shapes doesn't, so pooh to the
macro recorder, and hats of to you.
Regards - Dave.

"john" wrote:

see if this works for you.

A = Application.Caller
b = ActiveSheet.Buttons(A).Characters.Text
--
jb


"Dave" wrote:

Hi Tim,
Thanks for your help. But still stuck.
I have:

A = Application.Caller
B = ActiveSheet.Shapes(A).Characters.Text

The first line is working.
But the second line gives an error. Can you please point me to the right
syntax?
Regards - Dave.

"Tim Williams" wrote:

Application.Caller will give you the name of the button.

You can get the text using the name.

Tim

"Dave" wrote in message
...
Hi,
XL2003
I have some buttons on the Worksheet (from the Forms toolbar) which fire
specific macros.
Can VBA return (to a variable) the text of the button that fired it?
Regards - Dave.



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
Form buttons and Control Command Buttons ranswrt Excel Programming 0 August 7th 08 11:36 PM
Option Buttons/Radio Buttons John Calder New Users to Excel 7 May 16th 08 03:51 AM
Form buttons vs. ActiveX Buttons GeorgeJ Excel Discussion (Misc queries) 3 August 11th 07 09:02 PM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
Control Buttons vs. Command Buttons Robert Gibson Excel Programming 1 October 13th 03 04:33 PM


All times are GMT +1. The time now is 09:06 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"