Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Preventing file overwriting

I am using the following to check for the presence of a file and if presnet,
prevent it from copying over it. It does not seem to work.

Can someone please advise the proper way to accomplish this? Some example
code would be greatly appreciated.

Thanks.

If Dir("ArchivePathFilenameStr") = "" Then
FileCopy Source:=PathFilenameStr, Destination:=ArchivePathFilenameStr
Else
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Preventing file overwriting

Try this way:

Function FileExists(FName As String) As Boolean
FileExists = (Dir(Fname) "")
End Function


Use as follows

If FileExists("c:\test\test.xls") Then
'
' MsgBox "File exists"
'
Else
' whatever
End If


--
Steve

"TPJoseph" wrote in message
...
I am using the following to check for the presence of a file and if
presnet,
prevent it from copying over it. It does not seem to work.

Can someone please advise the proper way to accomplish this? Some example
code would be greatly appreciated.

Thanks.

If Dir("ArchivePathFilenameStr") = "" Then
FileCopy Source:=PathFilenameStr, Destination:=ArchivePathFilenameStr
Else
End If


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Preventing file overwriting

Thanks.

"AltaEgo" wrote:

Try this way:

Function FileExists(FName As String) As Boolean
FileExists = (Dir(Fname) "")
End Function


Use as follows

If FileExists("c:\test\test.xls") Then
'
' MsgBox "File exists"
'
Else
' whatever
End If


--
Steve

"TPJoseph" wrote in message
...
I am using the following to check for the presence of a file and if
presnet,
prevent it from copying over it. It does not seem to work.

Can someone please advise the proper way to accomplish this? Some example
code would be greatly appreciated.

Thanks.

If Dir("ArchivePathFilenameStr") = "" Then
FileCopy Source:=PathFilenameStr, Destination:=ArchivePathFilenameStr
Else
End If



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
Prevent overwriting a file Patrick C. Simonds Excel Programming 7 January 30th 09 08:32 AM
Check before overwriting file? Fan924 Excel Programming 2 December 2nd 08 06:06 AM
How to prevent overwriting of file ? [email protected] Excel Programming 4 March 19th 08 01:09 PM
Prevent user from overwriting file peter.thompson[_45_] Excel Programming 5 January 14th 06 12:31 PM
overwriting a file Jordan Shoderu Excel Programming 4 August 6th 04 11:46 AM


All times are GMT +1. The time now is 05:13 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"