Thread: SaveAs
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Malik[_2_] Malik[_2_] is offline
external usenet poster
 
Posts: 25
Default SaveAs

Hi,

Try this:
' Please change this line
If
Application.Dialogs(xlDialogSaveAs).Show(arg1:=Act iveWorkbook.Path & _
"\" & strDate & " - " & "PPE" & " " & strDate1 & " " & "T&A
Worksheet", arg2:=1) = True Then
ActiveWorkbook.RunAutoMacros Which:=xlAutoClose
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End If

*** Cancel button will return FALSE ***
--
Malik


"blerman" wrote:

I have created the following macro, which is supposed to save the file based
on values in specific cells and then exit Excel, but it needs to be modified
to not save the file if the users clicks on the cancel button in the SaveAs
dialog box. I am a novice when it comes to this so any assistance with
specific examples will be greatly appreciated.

Sub saveexit()
'
' saveexit1 Macro
' Macro recorded 03/31/2008 by Barry Lerman
'
'
With ActiveWindow
strDate = Range("d2")
strDate1 = Format(Range("L2"), "mm-dd-yy")
Application.Dialogs(xlDialogSaveAs).Show _
arg1:=ActiveWorkbook.Path & "\" & strDate & " - " & "PPE" & " " & strDate1 &
" " & "T&A Worksheet", arg2:=1
ActiveWorkbook.RunAutoMacros Which:=xlAutoClose
Application.Quit
ThisWorkbook.Close SaveChanges:=True

End With
End Sub