[VBA] Save a copy without macros
Solved
Elboubdelapampa
Posted messages
153
Registration date
Status
Member
Last intervention
-
jojo -
jojo -
Hello,
I have an Excel workbook with macros. I would like the macro to save a copy of the file without the macros at the end of the automated process.
Since I have chart sheets with links, I can't just copy and paste the data into other workbooks.
Is it possible to save a workbook without the macros?
Thank you in advance
Configuration: Windows XP / Firefox 3.6.7
I have an Excel workbook with macros. I would like the macro to save a copy of the file without the macros at the end of the automated process.
Since I have chart sheets with links, I can't just copy and paste the data into other workbooks.
Is it possible to save a workbook without the macros?
Thank you in advance
Configuration: Windows XP / Firefox 3.6.7
2 answers
-
Thank you, I tried, the Save as works well, but at the line
With ActiveWorkbook.VBProject, I get the error message
Run-time error '1004'
The 'VBProject' method for the '_Workbook' object failed
This can be translated as:
Error '1004'
The 'VBProject' method for the '_Workbook' object has failed
Any idea?-
Try the solution from MichDenis
Menu / Tools / Macros / Security / Trusted Editors /
both checkboxes must be checked. -
-
-
Good evening forum! I need help!
I want to use the code above but I'm struggling;
I want to create a copy of my workbook and save it in a directory (under a different name) while removing the macros; without closing my working workbook. The destination workbook should be closed for another person. In short, I want to save my workbook without the macros.
-
-
Hello,
Maybe a solution here from Frédéric Sigonneau, Laurent Longre, just that!!!
The code:sub SaveAsWithoutMacros() Dim NomSource$, CheminDest$, NomDest$ Dim VBC As Object NomSource = "EssaiSaveAs.xls" 'to adapt CheminDest = "C:\WindowsTemp" 'to adapt NomDest = "Essai.xls" 'to adapt Workbooks(NomSource).SaveAs CheminDest & NomDest With ActiveWorkbook.VBProject 'this part of the code is from Laurent Longre For Each VBC In .VBComponents If VBC.Type = 100 Then With VBC.CodeModule .DeleteLines 1, .CountOfLines .CodePane.Window.Close End With Else: .VBComponents.Remove VBC End If Next VBC 'LL End With Application.Quit SendKeys "%O" end sub
--
Best regards,
-- Every problem has its solution. If there is no solution, where is the problem? --