-
Solved: Application display alert question
I have the below code as part of a large code. Everything does what it should be doing but i'm still getting the "save as" promt appearing. I would rather it didnt and simply put the newly renamed file on the user's desktop. I thought the Application.DisplayAlerts True/False would have done it not noooooo
Dim Fname As String
Cancel = True
Application.DisplayAlerts = False
ChDir "C:\Documents and Settings\All Users\Desktop\"
Fname = Application.GetSaveAsFilename(ActiveSheet.Range _("AA54").Value, fileFilter:="xls Files (*.xls), *.xls")
If Fname <> "False" Then
ActiveWorkbook.SaveAs Fname
Application.DisplayAlerts = True
What can i do to kill the Prompt?
-
If you do not want to see a File Name Browser, and if the file name is always based on the value in Range("AA54").Value and you do not want to be prompted when over writing the file, then perhaps something like this:
[VBA]Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Fname As String
Application.DisplayAlerts = False
Fname = "C:\Documents and Settings\UserName\Desktop\" & ActiveSheet.Range("AA54").Value & ".xls"
ActiveWorkbook.SaveAs Fname
Application.DisplayAlerts = True
End Sub[/VBA]
-
Muuuuuch better. Thanks Frank!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules