Application.run problems... need help please

JerriBOH

New Member
Joined
Jan 25, 2009
Messages
14
Hello all you expert experienced and helpful users!
I am trying to use the Application.run statement to call a macro (MaterialReportWE) within the same workbook and it is not running. I can't see any spelling errors but when I open the Macro dialog box it shows the macro with the workbook name and the module name appended in front of it. It works fine when this is not the case (as with the "MaterialReport" macro). Some of the macros have this additional info and some don't. Why is that and how can I get rid of it or program code to accommodate it? I have checked thru all of the Macros in this file and there do not seem to be any duplicates that might require the additional names.

This is my statement: Application.run "MaterialReportWE"
In another macro I us Application.run "MaterialReport", which works fine.

The macro dialog box shows
'My File.xlsm'!MaterialReportWE.MaterialReportWE and
MaterialReport

Just having had an inspirational thought -- does VBA look at the first x number of chaaracters in the name and if they are the same it appends the additional modifiers? This may be the problem as I changed the name from MaterialReportWE to MatlReportWE and it lost the extra names. If so, does anybody know what the limit is?

Thanks for your attention!
 
Excellent suggestion - which I already did and that is why I know what the problem with the extra names is.

A bigger problem is that this file becomes a "Master" file and will be used over and over and saved as many names. That necessitates constructing code to deal with the variable name of the current workbook plus the macro name. While I can do that, I would prefer to have the macro listed with just the macro name -- and I want to be able to predict whether I need to do that or not. Thus my curiosity as to what triggers the phenomenon of the additional names appended to the beginning of the macro name...
 
Upvote 0
You don't have to explicitly reference the workbook name. You can use ActiveWorkbook. ;)
 
Upvote 0

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