ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning Macros (https://www.excelbanter.com/excel-programming/279327-assigning-macros.html)

T F Hewitt

Assigning Macros
 
I have recorded a Macro and created a command button but I
can not figure how to assign the macro top the command
button. I have follow MS instructions as far as right
clicking the sizing corners for the short cut menu but I
do not get the option on the shortcut menu to assign
Macro. I must not have something set right and MS assumes
to much in their directions

Thanks for any help.

Tom

Dave Peterson[_3_]

Assigning Macros
 
There are buttons from the Forms toolbar and the control toolbox toolbar.

The one from the Forms toolbar behaves the way you want. I bet you used the one
from the Controltoolbox toolbar.

So just delete that one and add one from the Forms toolbar.
(Then you'll be able to rightclick and assign your macro.)

T F Hewitt wrote:

I have recorded a Macro and created a command button but I
can not figure how to assign the macro top the command
button. I have follow MS instructions as far as right
clicking the sizing corners for the short cut menu but I
do not get the option on the shortcut menu to assign
Macro. I must not have something set right and MS assumes
to much in their directions

Thanks for any help.

Tom



T F Hewitt wrote:

I have recorded a Macro and created a command button but I
can not figure how to assign the macro top the command
button. I have follow MS instructions as far as right
clicking the sizing corners for the short cut menu but I
do not get the option on the shortcut menu to assign
Macro. I must not have something set right and MS assumes
to much in their directions

Thanks for any help.

Tom


--

Dave Peterson


Ronald Dodge

Assigning Macros
 
Okay, I have noticed this too in the past, though I forget exactly what it
was that caused the issue as it was in XL97. However, there is a way to get
around this. Follow the steps below:

If you don't have the Visual Basic toolbar up, bring it up.
To bring this up, right click in the toolbar area of the application,
then select "Visual Basic".

Have the Design button pressed in by clicking on it.

Right Click on your command button and then click on "View Code"
This will take you into the Visual Basic Editor with the Command button
shown in the upper left box.

In the upper right box, select the "Click" Event, if it's not already
selected.
This will automatically create a Private Sub command for the command
button's Click event.

In between the "Private Sub" and "End Sub" lines, put in the name of the
macro that you want assigned to the command button, provided it's within the
same workbook as the command button, otherwise, you will need to put in the
macro name in the following syntax:

<WorkbookName!<ModuleName.<MacroName

Note: <WorkbookName is the name of the workbook which is case sensitive
and must include the 3 letter extension. <ModuleName is the name of the
Module/Object that the macro is part of

Examples:

Book1.xls!Worksheets("Sheet1").MyMacro
Book1.xls!Module1.MyMacro2

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"T F Hewitt" wrote in message
...
I have recorded a Macro and created a command button but I
can not figure how to assign the macro top the command
button. I have follow MS instructions as far as right
clicking the sizing corners for the short cut menu but I
do not get the option on the shortcut menu to assign
Macro. I must not have something set right and MS assumes
to much in their directions

Thanks for any help.

Tom




Ronald Dodge

Assigning Macros
 
You beat me to it, but what I have done, I went into the View Code, then put
in the name of the macro within the Click Event procedure, as I ran into
this problem in the past under XL97, but thankfully for me, I was already
acquanted with VBA, when I ran into this issue.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"Dave Peterson" wrote in message
...
There are buttons from the Forms toolbar and the control toolbox toolbar.

The one from the Forms toolbar behaves the way you want. I bet you used

the one
from the Controltoolbox toolbar.

So just delete that one and add one from the Forms toolbar.
(Then you'll be able to rightclick and assign your macro.)

T F Hewitt wrote:

I have recorded a Macro and created a command button but I
can not figure how to assign the macro top the command
button. I have follow MS instructions as far as right
clicking the sizing corners for the short cut menu but I
do not get the option on the shortcut menu to assign
Macro. I must not have something set right and MS assumes
to much in their directions

Thanks for any help.

Tom



T F Hewitt wrote:

I have recorded a Macro and created a command button but I
can not figure how to assign the macro top the command
button. I have follow MS instructions as far as right
clicking the sizing corners for the short cut menu but I
do not get the option on the shortcut menu to assign
Macro. I must not have something set right and MS assumes
to much in their directions

Thanks for any help.

Tom


--

Dave Peterson





All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com