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

Hi,

Can anyone tell me how to insert a command button that
will initiate a macro?

Thanks in advance,

Nick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Command button

Hi,

if you wish to insert a button, what you need to do is
right click on your tool bar and select the option that
says 'Form'.
on this new tool menu you should have a button
called 'Button' if you then draw a box you will have a
button.
if you right click on the button and there is not an
option for 'Macro' then you will need to click on the
button and look in the formula bar, if the word 'EMBEDED'
is in this bar, delete it.
now when you right click on the button you have an option
to attach a macro!

Have fun!

Robert Couchman
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Command button

Nick,

I presume you mean in Excel, not on a userform?

Three ways:

Make sure the Forms menu is open (ToolsCustomizeToolbars), click the
button control, then on the worksheet right-click and size the button. You
will immediately be presented with a dialog box to assign a macro to he
button.

OR

Make sure the Control Toolbox toolbar is open (same way), click the button
control, then on the worksheet right-click and size the button. Then double
click the button and you will be taken to the VBE with a button click event
macro set-up where you can call your macro, or even add the code there.
Click the Design mode button on this control to exit Design.

OR

Add a button to a toolbar (ToolsCustomizeCommands) and select the Macros
option, then drag either the smiley or the text item onto an existing
toolbar. Right click the new button, and there is an option to assign a
macro.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Nick" wrote in message
...
Hi,

Can anyone tell me how to insert a command button that
will initiate a macro?

Thanks in advance,

Nick



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

Hello Nick,

Have you tried to use the macro recorder in
Tools/Macro/Record new macro ... ?

Record a macro with the recorder and add a button to any
existing commandbar - using the Customize... dialog,
picking a button and dropping it into a commandar, then
take it out and back onto the customize dialog. Once
you're done, you should be able to see a new module in
the VB Editor.

Use this code and the following one :

With CommandBars(Your commandbar name).Controls(your
control's index)
.Caption = (set the caption)
.OnAction = (name of the macro to be initiated
.FaceId = (set the appearance of the button)
End With

you should use the OnAction property.

-----Original Message-----
Hi,

Can anyone tell me how to insert a command button that
will initiate a macro?

Thanks in advance,

Nick
.

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
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Command button AOU Excel Discussion (Misc queries) 2 September 14th 07 06:32 PM
command button Hellboy Excel Discussion (Misc queries) 0 November 3rd 05 02:51 PM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


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