ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   filecopy (https://www.excelbanter.com/excel-programming/334768-filecopy.html)

Marvin

filecopy
 
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.

Gareth[_6_]

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.



All times are GMT +1. The time now is 04:30 PM.

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