Is there a way to Save As a spreadsheet that contains a macro, without having the macro saved into the new spreadsheet? Or removed the macro code before saving?
Thanks
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Remove Macros (Excel 2000)
Sorry, I was not detailed enough with my question. I can do it manually, but I am looking for a way to do it from code.
The spread sheet receives data from Access. The macros run to format the data. Then using code in Access I am saving the sheet under a different name than the one I opened. Can I remove the code from the Excel sheet using Access to automate the removal?
Thanks
Hi:
I am jumping into this thread because I have tried the method you suggest, but when I look for “Modules” in Project Explorer I don’t have any; I only have the “Microsoft Excel Objects”. Obviously, this makes it difficult to “Remove module”. In addition, I have tried to copy the sheets to a new book, in the hopes that the macros would not survive the copy process, but it seems they do: after saving that workbook, and re-opening it, it again tells me that macros exist, and asks me if I want to disable or enable them.Is it possible that I am not actually dealing with a macro, but with some other type of object that “appears” to be a macro, but is not?
Eric Halang
Hi Eric,
Have you checked whether any of the items listed under Microsoft Excel Objects contains code? You cannot remove these modules, but you can clear them.
If the workbook is “old”, it’s also possible that it contains a hidden Excel 4.0 macro sheet or Excel 5.0 dialog sheet.
One of the worksheets might contain an object that causes the warning. You can try Edit | Go To…, click Special, select Objects and click OK to find out which objects a sheet contains.
Hi, Hans;
I tried the “Edit, Go To, Special, Objects”, but no objects were found. On the other hand, all but one of the sheets DO contain the following, when I double-click them in the Project screen (or click View Code):
*****
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
End Sub
*****
This appeared to be causing the false macro warning, because I simply highlighted and deleted them, and after saving and reopening, there was no macro warning!
Thanks for the hints: do you forsee any problems with deleting those entries?
Eric
They do not show in the macro tools because they are event routines not regular macros and can not be run as a normal macro from the macro tools dialog box. The macro tools dialob box only shows macros that can be run from the box. For example, Function procedures do not show up there either.
The terminology is not entirely accurate: it should mention “VBA code” instead of “macros”. All macros contain VBA code, but not all VBA code consists of macros. But on the other hand, many users have at least heard of macros, while they might not know what is meant by VBA. So Microsoft chose to use the more familiar, if less accurate term.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications