PC Review


Reply
Thread Tools Rate Thread

how to close Read Only file without prompt to save copy

 
 
David
Guest
Posts: n/a
 
      6th May 2010
Hi
I'm working on an Excel file that will always be opened as Read Only by users.
To save confusion I would rather the user is not prompted to save the file
on exit.
I've tried application.displayAlerts = False in the Workbook BeroreClose
event code
but no joy so far.
Is it posible to achieve this?
Thanks
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      6th May 2010
Try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Close False
End Sub


--
Jacob (MVP - Excel)


"David" wrote:

> Hi
> I'm working on an Excel file that will always be opened as Read Only by users.
> To save confusion I would rather the user is not prompted to save the file
> on exit.
> I've tried application.displayAlerts = False in the Workbook BeroreClose
> event code
> but no joy so far.
> Is it posible to achieve this?
> Thanks

 
Reply With Quote
 
David
Guest
Posts: n/a
 
      6th May 2010
Thanks Jacob (I made sure to click on yes)

Worked fine

Is there any way to close the application "shell" along with the file
as is usual with only a single file open?

"Jacob Skaria" wrote:

> Try
>
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
> Me.Close False
> End Sub
>
>
> --
> Jacob (MVP - Excel)
>
>
> "David" wrote:
>
> > Hi
> > I'm working on an Excel file that will always be opened as Read Only by users.
> > To save confusion I would rather the user is not prompted to save the file
> > on exit.
> > I've tried application.displayAlerts = False in the Workbook BeroreClose
> > event code
> > but no joy so far.
> > Is it posible to achieve this?
> > Thanks

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      6th May 2010
Ofcourse YES; Try the below. Be careful this will quit the app; even if you
have other workbooks open..


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

--
Jacob (MVP - Excel)


"David" wrote:

> Thanks Jacob (I made sure to click on yes)
>
> Worked fine
>
> Is there any way to close the application "shell" along with the file
> as is usual with only a single file open?
>
> "Jacob Skaria" wrote:
>
> > Try
> >
> > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > Me.Close False
> > End Sub
> >
> >
> > --
> > Jacob (MVP - Excel)
> >
> >
> > "David" wrote:
> >
> > > Hi
> > > I'm working on an Excel file that will always be opened as Read Only by users.
> > > To save confusion I would rather the user is not prompted to save the file
> > > on exit.
> > > I've tried application.displayAlerts = False in the Workbook BeroreClose
> > > event code
> > > but no joy so far.
> > > Is it posible to achieve this?
> > > Thanks

 
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
Macro to save and close, then copy file NewSysAdmin Microsoft Excel Misc 2 2nd Dec 2009 03:24 PM
read log text file and prompt to user to open or save Raymond Chiu Microsoft C# .NET 0 10th Feb 2009 02:14 AM
Save copy of file to open as read only Ray Clark Microsoft Excel Misc 2 20th Jun 2008 12:19 AM
Intercepting the file save prompt before close? =?Utf-8?B?TmVpbCBCaGFuZGFy?= Microsoft Excel Programming 3 14th Feb 2006 03:19 AM
CLOSE ALL macro for XL2K (but with prompt to save for each file)? StargateFan Microsoft Excel Programming 2 10th Aug 2005 02:32 PM


Features
 

Advertising
 

Newsgroups
 


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