Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Close workbook without alerts

Hi,

I don't want users of my workbook to have the option of saving changes when
closing. I tried:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.DisplayAlerts = False
End Sub

.. . . but this doesn't work. How can I code my workbook to close with no
prompts to the user??

Thanks!!

Jeff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Close workbook without alerts

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False

End Sub

"Jeff Wright" wrote:

Hi,

I don't want users of my workbook to have the option of saving changes when
closing. I tried:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.DisplayAlerts = False
End Sub

.. . . but this doesn't work. How can I code my workbook to close with no
prompts to the user??

Thanks!!

Jeff



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Close workbook without alerts



--
---
Regards,
Norman
Microsoft Excel MVP



"Jeff Wright" wrote in message
...
Hi,

I don't want users of my workbook to have the option of saving changes
when closing. I tried:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.DisplayAlerts = False
End Sub

. . . but this doesn't work. How can I code my workbook to close with no
prompts to the user??

Thanks!!

Jeff



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Close workbook without alerts

Hi Jeff,

Try:

'=============
Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Cancel = True
MsgBox Prompt:="This workbook cannot be saved"
End Sub

'---------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub
'<<=============


---
Regards,
Norman



"Jeff Wright" wrote in message
...
Hi,

I don't want users of my workbook to have the option of saving changes
when closing. I tried:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.DisplayAlerts = False
End Sub

. . . but this doesn't work. How can I code my workbook to close with no
prompts to the user??

Thanks!!

Jeff



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Close workbook without alerts

Norman,

This is great, and does exactly what I want it to do!

Thanks,


Jeff


"Norman Jones" wrote in message
...
Hi Jeff,

Try:

'=============
Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Cancel = True
MsgBox Prompt:="This workbook cannot be saved"
End Sub

'---------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub
'<<=============


---
Regards,
Norman



"Jeff Wright" wrote in message
...
Hi,

I don't want users of my workbook to have the option of saving changes
when closing. I tried:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.DisplayAlerts = False
End Sub

. . . but this doesn't work. How can I code my workbook to close with no
prompts to the user??

Thanks!!

Jeff





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
alerts for changes in workbook olga Excel Discussion (Misc queries) 0 October 9th 06 09:07 PM
Help on Workbook close and workbook save events Adam Harding Excel Programming 1 September 29th 05 04:12 PM
Reset alerts when closing workbook? Brian Delaney Excel Programming 3 August 21st 05 03:41 PM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM
Closing a workbook with no alerts Antonio Atala Excel Programming 1 September 16th 03 04:32 AM


All times are GMT +1. The time now is 01:44 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"