PDA

View Full Version : Solved: remove vba



benong
08-30-2010, 12:24 AM
hi,
i have a template workbook1 with marco.
After some data manipulation, I want to save the workbook1(with marco) as workbook2(without marco).
How can i do this?

Bob Phillips
08-30-2010, 01:55 AM
Delete the code. Where is the macro, what is it called?

benong
08-30-2010, 05:00 PM
sorry, i forget to mention that i want to remove the marco automatically using marco.
eg. the marco in workbook 1 will perform some work, save itself as workbook2, and auto delete the marco in workbook2.
Can this be done?

Ken Puls
08-30-2010, 09:46 PM
Hi Benong,

FYI, Marco is a person, macro (c before the r) is VBA code.

With regards to your request, what version of Excel are you using? If you're using 2007/2010, then you can just save the file as an xlsx file, and it will automatically wipe the code out for you.

mikerickson
08-30-2010, 10:03 PM
Another alternative would be to move all your code into a normal module. When you make the new workbook, copy the sheet but not the module.
The only code that gets copyied would be event code like
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Call mySelectionChange(Target): Rem mySelectionChange is a routine in Module1
On Error GoTo 0
End Sub

benong
08-31-2010, 05:07 PM
many thanks for your guidance :)