Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Test if file exists Daniel Bonallack Excel Discussion (Misc queries) 2 May 4th 09 04:19 PM
Determine if a File Exists Connie Excel Discussion (Misc queries) 1 November 8th 06 09:11 AM
File Exists Mike McLellan Excel Discussion (Misc queries) 2 May 4th 06 09:20 AM
the file already exists - do you want to replace the existing file? Paul James[_3_] Excel Programming 4 December 12th 03 02:50 AM
Checking if file exists in VBA NADavies Excel Programming 3 October 23rd 03 02:16 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"