GetSaveAsFileName

G

Greg Hadrych

I have this line of code and it works great except for one
thing...


Private Sub Save_As_Click()

Workbooks("Master Template v2.2.xls").SaveCopyAs _
Application.GetSaveAsFilename("", fileFilter:= _
"Microsoft Excel Workbook, *.xls")

End Sub

If for say I click on the "Save_As" button on accident,
when I go to cancel the Save As window, it will still save
a copy of the document but it will be called "False". Am
I missing something from the formula or is there an If
Then statement I can add? Thanks for the help!
 
K

keepITcool

dim vName as Variant
vName = Application.GetSaveAsFilename("", fileFilter:= _
"Microsoft Excel Workbook, *.xls")
if vName <> False then
Workbooks("Master Template v2.2.xls").SaveCopyAs vName
end if

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Greg Hadrych wrote :
 

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

Top