Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting or Disabling code in Excel
Hello. I have an excel template that contains code in the background. I
want to be able to either delete or disable the code when the user saves the template as a .xls file. Any ideas? I have tried putting a version of "delete code on save" function in the template, but then when I save the template - it deletes the template code, which I don't want. Thanks, Cathy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting or Disabling code in Excel
Try this event code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If SaveAsUI Then Application.EnableEvents = False End If End Sub Regards, Stefi €˛Cathy W€¯ ezt Ć*rta: Hello. I have an excel template that contains code in the background. I want to be able to either delete or disable the code when the user saves the template as a .xls file. Any ideas? I have tried putting a version of "delete code on save" function in the template, but then when I save the template - it deletes the template code, which I don't want. Thanks, Cathy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting or Disabling code in Excel
Hi Stefi. Thanks for your reply. I already have that event in my code to
change all forumlas to values before saving so I just added the If statement to that event, but it didn't work. I tried putting it before and after but didn't work. In my workbook_open event I have a code that calls an open diaglog box for the user to select a file so I think this is what has to be "disabled" or "deleted" on save. Thanks again. "Stefi" wrote: Try this event code: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If SaveAsUI Then Application.EnableEvents = False End If End Sub Regards, Stefi €˛Cathy W€¯ ezt Ć*rta: Hello. I have an excel template that contains code in the background. I want to be able to either delete or disable the code when the user saves the template as a .xls file. Any ideas? I have tried putting a version of "delete code on save" function in the template, but then when I save the template - it deletes the template code, which I don't want. Thanks, Cathy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
enabling/disabling a set of code from within a spreadsheet sheet | Excel Discussion (Misc queries) | |||
Disabling code using a button? | Excel Programming | |||
VB code for disabling | Excel Programming | |||
Disabling Sheet Code | Excel Programming | |||
Disabling a cell for editing or deleting | Excel Programming |