ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs needed if new (https://www.excelbanter.com/excel-programming/275304-re-saveas-needed-if-new.html)

Chip Pearson

SaveAs needed if new
 
Wes,

You can use the Path property to determine whether a workbook has ever been
saved. If this property returns an empty string, you are working with a new,
unsaved workbook. E.g.,

If ActiveWorkbook.Path = "" Then
' new, unsaved workbook
Else
' existing workbook
End If

You can use the Saved property to determine whether a workbook is in a saved
state, i.e., no save is required. E.g.,

If ActiveWorkbook.Saved = True Then
' no save required
Else
' save required.
End If

You can use the Application.GetSaveAsFilename to display the Save As dialog.
This method will return the file name chosen by the user. Note the
GetSaveAsFilename does not actually save the file; it merely returns a
filename. E.g.,

Dim FName As Variant
FName = Application.GetSaveAsFilename()
If FName = False Then
' user cancelled
Else
MsgBox "File name: " & FName
End If

Combining the above procedures should give you the functionality you need.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com






"Wes Jester" wrote in message
...
Is there a method to invoke something similar to the "standard" save.
My users can open an exisitng spreadsheet or a new S/S using a template.
As part of the app, I need to determine if the sheet they are working on
has already been saved. If so, I can simply issue a object.Save.

Otherwise, I would like the app to mimic the Save action that happens
when you save a workbook the first time.

Essentially, I want to do exactly what EXCEL does when one tries to do a
Save the first time. I just don't know how to do it in code.

Any help is appreciated.


Wes

*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 02:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com