Macro problems

m. silva

New Member
Joined
Mar 11, 2004
Messages
2
1. In excel, when I create macros in a workbook, I give the macro a name. when I save that workbook as another file, the macros do not work (warning message comes up to end or debug).
In checking out the macros, I find that they all have names that are preceded by the original file name ending with a punctuation mark. I have tried stripping the file name away with a "find and replace" procedure, but that does not work either. One copy of this file can no longer be opened and crashes. How can I create macro names that remain with the work book and not have extensions added to them? IE ("SortAll" not "Template1!SortAll").

2. In trying to save this file, I have deleted all macros, but upon opening the file, I get the warning about macros. How do I completely remove all macros so I do not get that message.
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,946
Office Version
  1. 365
Platform
  1. Windows
1. The macros really aren't saved with the name "Template1!SortAll", they are saved with the name "SortAll". If you have multiple files open in Excel, it just shows which workbooks the macros are saved in by showing the name preceding the macro.

Think of it like referencing a cell on a different worksheet. If you go to Sheet 2, and in a cell enter "=" and then choose on cell on Sheet 1, Excel will enter "Sheet2!A1".

In your code, do you have any references to the name of the file? That would cause errors if you changed the name of the file and tried running the macro. Post you code if you still need help with this.

2. You must also delete the module that held the macro. In the Vb editor, highlight the module, right click, and select and select "Remove Module1"
 

m. silva

New Member
Joined
Mar 11, 2004
Messages
2
jmiskey
Thank you for the help. I have not yet attempted to fix my no 1 problem.
Regarding no. 2, I deleted the modules as you suggested, however, when I reopen the workbook, I still get the macro warning box. Any other suggestions?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,946
Office Version
  1. 365
Platform
  1. Windows
Are you sure you deleted all the macros out of the ThisWorkbook and Sheet modules also?

Also, verify that in the VB Project Explorer, you should no longer see a folder named "Modules" for that file.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,820
Messages
5,598,301
Members
414,224
Latest member
Crazy_FC

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
Top