Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Excel VBA - Save file if it has not been saved yet

Posted on 2011-10-31
Medium Priority
Last Modified: 2012-05-12
I am sending an Excel file as an email attachment and want code to check if the file has been saved.  If it has NOT been saved, then prompt the user to save with the same name as the file already has.

It can be saved anywhere.

Thanks, --Andres
Question by:AndresHernando
LVL 85

Accepted Solution

Rory Archibald earned 2000 total points
ID: 37055506
For example:

   Dim SaveName          As Variant
   If ActiveWorkbook.Saved = False Then
      SaveName = Application.GetSaveAsFilename( _
      If SaveName <> False Then ActiveWorkbook.SaveAs SaveName
   End If

Open in new window


Author Closing Comment

ID: 37055618
Thanks Rory.  Just what I needed.   --Andres

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question