Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to remove Excel VBA code automatically

Status
Not open for further replies.

AppSpecialist

Programmer
Jul 6, 2001
64
CA
I have an excel spreadsheet with VBA code attached.

A portion of this code will eventually save the excel data to a new workbook. However I do not want the VBA code to be saved with the new workbook.

How can I remove or rename the procedure so it will not auto execute (workbook open)?

Thanks
 
Hi,

How about setting a value in a discreet cell so that if that particular cell is null then execute you code otherwise, don't!

Cheers,
Carl.
 
Yes, I have already done that... but the subsequent spreadsheet will still notify user that macros exist and will ask to enable or disable them.
 
Instead of saving the entire workbook, why not copy the sheets to a new book and save that .... no macros will be in that file.



Glenn.
 
The following code will copy work & chart sheets of the container workbook to a new workbook and save it with the given path\filename.

Sub Copy()
ThisWorkbook.Sheets.Copy
ActiveWorkbook.SaveAs "Path\FileName"
End Sub

If there is any code behind any of the sheets, it will also be copied, but general modules will not copy over.

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top