Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
enabling/disabling a set of code from within a spreadsheet sheet Roger on Excel Excel Discussion (Misc queries) 2 November 17th 07 05:04 PM
Disabling code using a button? Simon Lloyd[_505_] Excel Programming 6 June 23rd 04 02:16 PM
VB code for disabling DJ Excel Programming 2 November 10th 03 09:01 AM
Disabling Sheet Code Stuart[_8_] Excel Programming 2 October 2nd 03 12:34 AM
Disabling a cell for editing or deleting Tom Ogilvy Excel Programming 0 September 25th 03 04:47 AM


All times are GMT +1. The time now is 08:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"