VBA Module Name

328mike

New Member
Joined
Jul 5, 2011
Messages
47
I changed the Module names for a few of my macros in VBA and now their shortcuts wont work in Excel and I can't create any shortcut. What is the problem here?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello 328Mike,

Changing a module name does not affect the macro's procedure name. The shortcut only cares about the procedure name so something else must be going on.

You say you can not create a shortcut. Do this apply only to the previous macros or to new ones as well? Are you assigning the shortcut using VBA code or manually with the macro dialog? Which modules names did you change?

Sincerely,
Leith Ross
 
Upvote 0
Hello 328Mike,

Changing a module name does not affect the macro's procedure name. The shortcut only cares about the procedure name so something else must be going on.

You say you can not create a shortcut. Do this apply only to the previous macros or to new ones as well? Are you assigning the shortcut using VBA code or manually with the macro dialog? Which modules names did you change?

Sincerely,
Leith Ross

Module names were Module 1 Module 2 Module 3...etc.

I changed them to reflect the macros they contained.

This is what happened to the macro text in the macro menu list after doing that:

PERSONAL.XLSB!CGMFormattingWIRELINE.CGMFormattingWIRELINE

it doubled the name for all of them. The shortcuts I have assigned and any new shortcuts I assign won't work.
 
Upvote 0
Hello 328Mike,

It looks like you gave your module the same name as the macro. If you did then that is the problem. This will confuse the VBA compiler. I will use underscores in my module names (spaces are not allowed) so I know what the macro is but not confuse VBA.

For example, I would name the module CGM_Formatting_WIRELINE and the macro name would be CGMFormattingWIRELINE. Change the name, resave the file, and you should be okay.

Sincerely,
Leith Ross
 
Upvote 0
Hello 328Mike,

It looks like you gave your module the same name as the macro. If you did then that is the problem. This will confuse the VBA compiler. I will use underscores in my module names (spaces are not allowed) so I know what the macro is but not confuse VBA.

For example, I would name the module CGM_Formatting_WIRELINE and the macro name would be CGMFormattingWIRELINE. Change the name, resave the file, and you should be okay.

Sincerely,
Leith Ross
Thanks a ton!!
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,351
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top