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


Hi,

I've writtten a macro under VBA and associate it to a button (Display,
toolbar, form).
Is it possible to be connected with this button in my vba code to
modify its caption for instance ??
YES ???
Great !!
How ???

Thanks


--
LeBob
------------------------------------------------------------------------
LeBob's Profile: http://www.excelforum.com/member.php...o&userid=31185
View this thread: http://www.excelforum.com/showthread...hreadid=508563

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro button

In the macro associated, you can do

Sub Btn_Click()
Dim btn as Button
set btn = Activesheet.Buttons(Application.Caller)
If lcase(btn.Caption) = "no" then
btn.Caption = "Yes"
elseif lcase(btn.Caption) = "yes" then
btn.Caption = "No"
end if
End Sub

--
Regards,
Tom Ogilvy

"LeBob" wrote in
message ...

Hi,

I've writtten a macro under VBA and associate it to a button (Display,
toolbar, form).
Is it possible to be connected with this button in my vba code to
modify its caption for instance ??
YES ???
Great !!
How ???

Thanks


--
LeBob
------------------------------------------------------------------------
LeBob's Profile:

http://www.excelforum.com/member.php...o&userid=31185
View this thread: http://www.excelforum.com/showthread...hreadid=508563



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Macro button

With ActiveSheet.DrawingObjects(Application.Caller)
..Text = "Clicked me!"
End With

Tim

"LeBob" wrote in
message ...

Hi,

I've writtten a macro under VBA and associate it to a button (Display,
toolbar, form).
Is it possible to be connected with this button in my vba code to
modify its caption for instance ??
YES ???
Great !!
How ???

Thanks


--
LeBob
------------------------------------------------------------------------
LeBob's Profile:
http://www.excelforum.com/member.php...o&userid=31185
View this thread: http://www.excelforum.com/showthread...hreadid=508563



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro button


I will try that right now !!! :)

thanks everboby


--
LeBob
------------------------------------------------------------------------
LeBob's Profile: http://www.excelforum.com/member.php...o&userid=31185
View this thread: http://www.excelforum.com/showthread...hreadid=508563

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Macro button

Hi LeBob, Tom and Tim,
the coding of buttons has been a very confused part of my thinking.
(Tom, I'm sure is very aware of this, he has corrected me in the not
too distant past). After seeing this thread I'm now amazed at just how
easy it is to code for buttons. How on earth did I managed to become so
confused in the past?
A big Thank You to all of you for helping me improve my VBA by
revealing such simple and very useful button code.
Ken Johnson

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
Use Macro To Change Which Macro Assigned To Command Button CVinje Excel Discussion (Misc queries) 0 May 25th 10 09:55 PM
Creating a macro which presses a button containing a recorded macro petros89[_3_] Excel Programming 3 October 5th 05 02:49 PM
Can't select macro button after other button is pressed C. Campbell Excel Programming 1 November 30th 04 07:46 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM
How to end macro on inital active worksheet containing macro button that was clicked Silverhawk1 Excel Programming 2 May 14th 04 03:58 PM


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