Saving without VBA code

  • Thread starter Thread starter Carl Rapson
  • Start date Start date
C

Carl Rapson

I have a workbook that has some VBA code in the ThisWorkbook module to
define a toolbar button. This button uses VBA code in another module to save
a set of ranges to a new spreadsheet file. I accomplish this by creating a
new workbook, copying each range (each is on a separate worksheet), then
saving the new workbook with a new name. Unfortunately, the VBA code in
ThisWorkbook is also copied to the new workbook, so when the new spreadsheet
file is opened, it also has the toolbar button. Is there any way to do this
without also copying the VBA code from ThisWorkbook? Or, is there a way to
remove that code from the new file?

Thanks for any information,

Carl Rapson
 
Chip Pearson has some techniques to delete code, but before you do this, how is
the code getting from the masterworkbook to the copy?

I've never seen code go from ThisWorkbook in one project to another Thisworkbook
in a new project when you create a new workbook.

dim wkbk as workbook
set wkbk = workbooks.add(1)

creates a new workbook w/o code in ThisWorkbook.

oh, here's that link to Chip's site:
http://www.cpearson.com/excel/vbe.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top