PC Review


Reply
Thread Tools Rate Thread

Close workbook without alerts

 
 
Jeff Wright
Guest
Posts: n/a
 
      21st Apr 2007
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 With Quote
 
 
 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      21st Apr 2007
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
>
>
>

 
Reply With Quote
 
Norman Jones
Guest
Posts: n/a
 
      21st Apr 2007


--
---
Regards,
Norman
Microsoft Excel MVP



"Jeff Wright" <(E-Mail Removed)> wrote in message
news:6noWh.192525$(E-Mail Removed)...
> 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 With Quote
 
Norman Jones
Guest
Posts: n/a
 
      21st Apr 2007
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" <(E-Mail Removed)> wrote in message
news:6noWh.192525$(E-Mail Removed)...
> 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 With Quote
 
Jeff Wright
Guest
Posts: n/a
 
      21st Apr 2007
Norman,

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

Thanks,


Jeff


"Norman Jones" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:6noWh.192525$(E-Mail Removed)...
>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
error in running workbook.close() func. after close excel from win Kayıhan Microsoft C# .NET 0 29th Mar 2009 12:49 AM
SSL Close Notify Alerts Ashok Kumar C Windows XP Internet Explorer 0 25th Jan 2008 07:43 AM
alerts for changes in workbook =?Utf-8?B?b2xnYQ==?= Microsoft Excel Misc 0 9th Oct 2006 09:07 PM
Re: How can I close Outlook and still get alerts? Brian Tillman Microsoft Outlook 1 1st Sep 2004 03:23 AM
Excel 2000 Workbook close button hides instead of close Steven Robinson Microsoft Excel Misc 3 13th Aug 2003 11:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:37 PM.