Thread: Case Select
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Daviv Daviv is offline
external usenet poster
 
Posts: 39
Default Case Select

I have the following code:


InitFileName = Range("File").Value & Range("Project").Value & " " & "Insp._
Report," & " " & Format(Report(0, 1), "d-mmm-yy") & ".xls"
MsgResult = MsgBox("Have you saved the file?", vbYesNoCancel)
Select Case MsgResult
Case vbNo
FName = Application.GetSaveAsFilename(InitFileName,
"Excel File_(*.xls),*.xls")
ActiveWorkbook.SaveAs FName, CreateBackup = False
Cancel = True
Exit Sub
Case vbYes
ThisWorkbook.Saved = True
Application.Quit
Case vbCancel
Exit Sub
End Select
End Sub

When I select "cancel", the application quit instead of just exiting the sub
and going back to the worksheet.

Thanks!