Thread: Workbook.SaveAs
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Kevin B Kevin B is offline
external usenet poster
 
Posts: 1,316
Default Workbook.SaveAs

I had forgotten all about that. Thanks for the heads-up.

One should never underestimate the end-user, the mistake you don't code for
is the one they seem to do.
--
Kevin Backmann


"Chip Pearson" wrote:

If no file name is entered in the Save As dialog box the GetSaveAsFilename
function returns the string "FALSE" as its value.


This is sort of correct. If the user cancels out of GetSaveAsFileName, it
returns a Boolean False value, which when stored in a String variable
becomes the string "False". But you will get the same result if the user
enters a file name "False". It is better to store the result of
GetSaveAsFileName in a Variant type, test that for False (Boolean, not
String -- no quotes) and act accordingly:

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


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

"Kevin B" wrote in message
...
If no file name is entered in the Save As dialog box the GetSaveAsFilename
function returns the string "FALSE" as its value.
--
Kevin Backmann


"Boris" wrote:

On Wed, 10 Oct 2007 10:51:03 -0700, chemicals wrote:

....
If strDocName < "False" Then
....

Why quotes around False?

B.