ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save as and file exists. (https://www.excelbanter.com/excel-programming/300000-save-file-exists.html)

Barry

Save as and file exists.
 
I am running some code to save a file. I am passing the filename as a variable (not important really)

However I want to be able to invoke some action if the file exists. In particular action to respond to the No and Cancael options from dialog

What do I add to my code to do this

Barr

afID = Worksheets("Form-E").Range("J1"
myPath = ThisWorkbook.Path & "\My PAFs\" & PafID & ".xls

ActiveWorkbook.SaveAs Filename:=myPath, FileFormat:=
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False
, CreateBackup:=Fals


Vasant Nanavati

Save as and file exists.
 
You'll have to roll your own BeforeClose event, as shown by John Walkenbach:

http://j-walk.com/ss/excel/tips/tip78.htm


--

Vasant

"Barry" wrote in message
...
I am running some code to save a file. I am passing the filename as a

variable (not important really).

However I want to be able to invoke some action if the file exists. In

particular action to respond to the No and Cancael options from dialog.

What do I add to my code to do this?

Barry

afID = Worksheets("Form-E").Range("J1")
myPath = ThisWorkbook.Path & "\My PAFs\" & PafID & ".xls"

ActiveWorkbook.SaveAs Filename:=myPath, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",

ReadOnlyRecommended:=False _
, CreateBackup:=False





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

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