Macro/Command Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Excel 2000 (or 97)
Although it's been a while, I have done this, but I cannot get it work now.
I created a macro by using the macro recorder. I gave it the name Release. I
then created a command button on the worksheet. The name of button is
btnRelease. In design view, I selected the button and clicked ViewCode. That
gave me the click event:
Private Sub btnRelease_Click(). Between that and End Sub, I wrote "Release"
(no quotation marks). I thought that would reference the macro and run it. I
get the message "Function or interface marked as restriced, or function uses
Automation type not supported in Visual Basic.
Am I missing a step?
I'll appreciate the help,
 
I just used the macro recorder to sort a work sheet on the date field. I gave
the macro a softcut key: Cntr-Shift-R. The macro works fine if I use the
short cut key. I thought I could just reference the macro by name (Release)
in the Click event of the command button to get it to run. Doesn't work.(?)
 
If it breaks in xl97, try adding:

activecell.activate

at the top of the code.

Or you can change the .Takefocusonclick to false for that commandbutton.
 
The Takefocusonclick property is set to false. Activecell.activate didn't
correct it. But, thanks for the response.
 
Tried it. Still isn't working.
I have to go out for a while. I'll try to check back later. Thanks for all
your responses!
Howard
 
Not that I know. (While in the VBE, I hit F2 to bring up the object browser and
only found one Release and that was ReleaseFocus.)

Glad you got it working, but I don't think I'd live with Sort as the name. That
is a method name (like range("a1:b99").sort...


Is "Release" a restriced name in Excel? I changed the macro name to Sort and
again in the Click Event from Release to Sort, and it is working now. That's
all I think I did. I've been playing with it too long.
HF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top