Thread: filecopy
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gareth[_6_] Gareth[_6_] is offline
external usenet poster
 
Posts: 158
Default filecopy

You don't mention whether you write to the destination folder though.

Try copying the below code into a module. Run the Sub Test and paste
back the debug results.

Sub Test()

fncFileAccessTest "c:\temp\crap.txt"
fcnFileAccessTest "c:\crisnet\export\CMA_ACT.dbf"
fcnFileAccessTest "c:\crisnet\export\CMA_Toolkit_Data\CMA_ACT.db f"

End Sub
Function fcnFileAccessTest(myPath As String)

Dim myFolder As String
Dim myFile As String
Dim F As Integer

myFolder = Left$(myPath, InStrRev(myPath, "\") - 1)
myFile = Mid$(myPath, InStrRev(myPath, "\") + 1)

Debug.Print "Testing for " & myPath
Debug.Print " Folder " & IIf(Dir(myFolder, vbDirectory) _
= "", "does not exist", "exists")
Debug.Print " File " & IIf(Dir(myFolder & "\" _
& myFile) = "", "does not exist", "exists")
F = FreeFile
Err.Clear
On Error Resume Next
Open myFolder & "\temp.tmp" For Output As #F
Debug.Print " You do " & IIf(Err.Number = 0, "", "NOT ") _
& "have write rights to this folder"
Kill (myFolder & "\temp.tmp")
Close #F

On Error GoTo 0

End Function


Marvin wrote:
This fails with a path or access 75

FileCopy "c:\crisnet\export\active.dbf",
"c:\crisnet\export\CMA_Toolkit_Data\CMA_ACT.db f"

The CMA_Toolkit_Data folder exists and this statement works on another
machine. I have been able to save to c:\crisnet\export only so I know that
the source part is working.