|
-
May 6th, 2010, 04:09 PM
#1
Thread Starter
New Member
[RESOLVED] Suppressing the Save Prompt on file close
Hi folks,
I have created a little tool in a standalone Excel file (no db connections or anything).
The tool has 2 ListBox controls. When the workbook opens, I populate ListBox1.
When the user clicks a value in ListBox1, I populate ListBox2 with the Items related to the user's selection.
I keep the workbook protected (except for one cell that I use to store a variable for as long as the work book is open).
This all works fine.
I have only one issue now.
I've noticed that when I am done using the tool and I close the workbook, Excel prompts me to save the file. I don't ever want anyone to save any changes to this file. It is for reference purposes only.
I've tried returning all the controls (and that one unprotected cell) to their initial state, but I still get the save prompt.
I've tried setting DisplayAlerts to False in the BeforeClose event, but it had no effect.
I do not want to close the workbook from code.
I cannot close the app because the user may have other workbooks open.
I just want to suppress the Save prompt when the user closes the tool.
I've been searching here and elsewhere but cannot seem to find a solution.
Any ideas?
-
May 6th, 2010, 04:20 PM
#2
Re: Suppressing the Save Prompt on file close
you can try
in the before close event
thisworkbook.saved = true
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 7th, 2010, 05:57 PM
#3
Thread Starter
New Member
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|