Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SaveAs
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SaveAs
When it copied this code I receive a compile syntax error. Any suggestions?
"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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using the SaveAs in VBA | Excel Programming | |||
Help with SaveAs | Excel Programming | |||
SaveAs | Excel Programming | |||
SaveAs,csv | Excel Programming | |||
saveas | Excel Programming |