Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prevent overwriting a file | Excel Programming | |||
Check before overwriting file? | Excel Programming | |||
How to prevent overwriting of file ? | Excel Programming | |||
Prevent user from overwriting file | Excel Programming | |||
overwriting a file | Excel Programming |