PC Review


Reply
 
 
=?Utf-8?B?RGF2aXY=?=
Guest
Posts: n/a
 
      5th Mar 2007
I have the following code:
Case vbNo
FName = Application.GetSaveAsFilename(InitFileName,
"Excel File_ (*.xls),*.xls")
If FName <> False Then
ActiveWorkbook.SaveAs FName, CreateBackup = False
Else
Exit Sub
End If
Case vbYes
ThisWorkbook.Saved = True
Application.Quit
Case vbCancel
Cancel = True
Exit Sub

My question is: For case vbno, instead of saving the file and I cancel the
SaveAs, the application quits when I only want to exit the sub and return to
the worksheet.
--
Thanks!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      5th Mar 2007
In what event is this code located in? Assuming it's on the
Workbook_BeforeClose event, add Cancel=True before calling exit sub. So,

Cancel=True
Exit Sub



"Daviv" wrote:

> I have the following code:
> Case vbNo
> FName = Application.GetSaveAsFilename(InitFileName,
> "Excel File_ (*.xls),*.xls")
> If FName <> False Then
> ActiveWorkbook.SaveAs FName, CreateBackup = False
> Else
> Exit Sub
> End If
> Case vbYes
> ThisWorkbook.Saved = True
> Application.Quit
> Case vbCancel
> Cancel = True
> Exit Sub
>
> My question is: For case vbno, instead of saving the file and I cancel the
> SaveAs, the application quits when I only want to exit the sub and return to
> the worksheet.
> --
> Thanks!

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      5th Mar 2007
Have you declared FName as type Variant

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Daviv" <(E-Mail Removed)> wrote in message
news:436158AB-EF17-4156-84FA-(E-Mail Removed)...
>I have the following code:
> Case vbNo
> FName = Application.GetSaveAsFilename(InitFileName,
> "Excel File_ (*.xls),*.xls")
> If FName <> False Then
> ActiveWorkbook.SaveAs FName, CreateBackup = False
> Else
> Exit Sub
> End If
> Case vbYes
> ThisWorkbook.Saved = True
> Application.Quit
> Case vbCancel
> Cancel = True
> Exit Sub
>
> My question is: For case vbno, instead of saving the file and I cancel the
> SaveAs, the application quits when I only want to exit the sub and return
> to
> the worksheet.
> --
> 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
Select Case in a Change Event Risky Dave Microsoft Excel Programming 6 18th Dec 2009 02:35 PM
combo box change event & case select Excel-General Microsoft Excel Discussion 17 20th Jan 2008 12:20 AM
Event Viewer Currupt ! - Case for Microsoft ? > Item has already been the.fantom@wheelweb.com Windows Vista Installation 3 12th Dec 2007 08:22 PM
Can't find short cut for changing case ... upper case .... lower case JERRY Microsoft Word New Users 7 23rd Aug 2007 05:29 PM
Event ID: 5719 Netlogon Error - Another case Dion Pauls Microsoft Windows 2000 Networking 1 12th May 2004 06:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:28 AM.