View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Disable save/saveas dialog box upon closing

After serious thinking Schatzi wrote :
On May 3, 1:58*pm, Matthew Dyer wrote:
On May 3, 11:52*am, Matthew Dyer wrote:





On May 3, 11:50*am, Schatzi wrote:
I saw another topic on this where the user wanted to automatically
save. I have macros running that disable saving and want the dialog
box not to automatically pop-up as the save button on it doesn't work
anyway.


I was trying all kinds of code such as:
Sub Auto_Close()
WorkbookObject.Saved = True
WorkbookObject.Close
End Sub


I also tried:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
End Sub


Still, when I close the application, I get the box asking if I would
like to save changes. How do I keep this box from automatically
popping up? I searched other answers and saw that they recommended
code that automatically saved it, but that is different. I thought I
would be able to simply adjust the code, but I couldn't figure that
out.


Also, I am using ThisWorkbook as I imagine that is the right place for
such code. Please correct me if I am wrong. Thank you.
set enable events to false
Application.EnableEvents = False- Hide quoted text -
- Show quoted text -


oops, got mixed up. it's actually display alerts.. not enable events.

Application.DisplayAlerts = False- Hide quoted text -

- Show quoted text -


I had already tried Application.DisplayAlerts = False

I just now inserted the code by GS and it is still not working. When I
click the "x" to close the workbook, the message still pops up asking
if I would like to save changes. I put the code exactly like GS had
into ThisWorkbook. Any ideas of what I can be doing wrong?


Perhaps your WorkbookObject var was not holding a fully qualified ref
to the wkb being closed. Otherwise, the code I posted worked for the
file I tested it with.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc