View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Can't add macros to buttons I've created....

you don't assign a macro to control toolbox controls, like you would
if it's an autoshape that you want to turn into a button. you have to
have the toolbar set on design mode; double-click the button & it will
open up the worksheet private sub in the vba editor. then copy your
macro from an ordinary module & paste it here. Warning - if you do
this, the command button & that macro will only work on that specific
worksheet. if you want it to work in other places besides JUST this
worksheet, instead of copying the macro, call it from the command
button macro:

private sub command_click1()

call ExtraSub

end sub

and leave the macro in the original module where it is. but you might
have to change the macro to a public macro:

public sub ExtraSub()
end sub

susan




On Feb 8, 1:50 pm, joe wrote:
Jim,

I am having a similar problem. I can get into design mode; but when I
right-click to add a macro that is recorded and saved in the worksheet I'm
working in, I don't get the "Assign a Macro" option like the help section
says.

I select the button, white circles appear on the corners and along the
edges; but I seen no way to assign the macro I need.

I also tried to copy the VB code of my macro into the button's code. Here
the macro just errors out.

The macro is a simple refresh query macro I recorded and saved. Could you
help?



"Jim Thomlinson" wrote:
You need to put the sheet into design mode. Click the Traingle & Ruler &
Pencil button on the control toolbox to enter design mode... Now you can work
with your buttons via right click...
--
HTH...


Jim Thomlinson


"tim m" wrote:


Greetings,


I created a series of buttons on one page of my workbook via the control
toolbox, command button. I formatted them the way I wanted them to look with
the intention of assigning simple recorded macros to each button. I saved
and closed the sheet for a while now after I open the sheet again I cannot do
a thing with the buttons. They are there, you can press them but nothing
happens. I have not assigned any macros to them. Right clicking on them
does nothing, left clicking on them depressed the button but of course
nothing happens because no macros have been assigned. I can't seem to get
any of the formating menus up by right clicking on the buttons.


Any thoughts on what I have done wrong? I just want to assign some simple
macros to the buttons but at this point I am unable to.- Hide quoted text -


- Show quoted text -