ActiveWorkbook.SaveAs Returns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone point me in the direction of expected returns when using
ActiveWorkbook.SaveAs (or Open). How do I capture a "Cancel" or "No"
selection?
 
Sorry, I'm not exactly sure what you're asking. Specifically, I want to know
what I need to add to the following subroutine in Excel. If "temp.xls"
already exists, how do you capture the "Cancel" or "No" response on the
dialog box that asks if you want to replace the existing file.

sub test()
ActiveWorkbook.SaveAs ("temp.xls")
end sub
 
SaveAs doesn't return anything. It is a sub, not a function. If you really
need to know the reply from the user, the best way is to intercept the
BeforeSave event in the ThisWorkbook module, test the SaveAsUI parameter,
and if that is True, set the Cancel parameter to True and put up your own
dialog to handle saving.



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email 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

Back
Top