SaveAs

G

Guest

I have the following code:

FName = Application.GetSaveAsFilename(InitFileName, "Excel File
(*.xls),*.xls")
ActiveWorkbook.SaveAs FName, CreateBackup = False

When I cancel the save, I get a "FALSE" file. I believe this is a backup
file so I set Createbackup = false. But no luck. Thanks in advance.
 
G

Guest

If you cancel Application.GetSaveAsFilename the it returns "FALSE". You need
to check for this before saving

FName = Application.GetSaveAsFilename(InitFileName, "Excel File
(*.xls),*.xls")
if FName <> "FALSE then
ActiveWorkbook.SaveAs FName, CreateBackup = False
end if
 
C

Chip Pearson

Declare FName as a Variant and test it for False (not "False"). E.g.,

Dim FName As Variant
FName = Application.GetSaveAsFilename(....)
If FName = False Then
Debug.Print "User Cancelled"
Else
Debug.Print "Filename: " & FName
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Case Event 2
Case Select 2
Before Save 1
Simplify save code 11
xltm saveas xlsm 6
ActiveWorkbook.SaveAs in excel 2007 4
Save As Then Replace Bombs Out 2
getsaveasfilename loop... <> false and not already exists 2

Top