Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Runtime Error 75 path/file not permitted

darthmoobeydarthmoobey Member Posts: 140
I keep getting this error on this code recomended by Infidel. Was urged to not use fso and it looked to work well... it reads the file, but does not send it to the specified folder location. Can anyone help me with this error, I have been trying to find resource information online bout it, but was hoping someone here could shed bit more light.

[code]
Private Sub cmdOk_Click()
Static FolderChecked As Boolean
Dim FileName As String
FileName = ListDir.Path & _
IIf(Right$(ListDir.Path, 1) = "", "", "") & listFile.FileName
'Now we'll cheat to make sure the folder exists,
'though you're SOL if a file by those names exists.
If Not FolderChecked Then
On Error Resume Next
MkDir "c:projects"
MkDir "c:projectsparyoll 2"
MkDir "c:projectsparyoll 2data"
On Error GoTo 0
'So it'll only be checked the first time
FolderChecked = True
End If
FileCopy FileName, "c:projectsparyoll 2data" <--- error is here

End Sub
[/code]

again thank you

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    [b][red]This message was edited by BitByBit_Thor at 2004-3-25 9:43:16[/red][/b][hr]
    FileCopy can't copy directories I think. Try to supply the new filename (And are you sure the code for FileName is correct? FileTitle and FileName in one? Most of the time control.FileName means the entire path and file)

  • darthmoobeydarthmoobey Member Posts: 140
    ok I did some reading and debugging, apparently what you need to do is add a file name at the end of the FileCopy routine. Example:

    [code]
    Private Sub cmdOk_Click()
    Static FolderChecked As Boolean
    Dim FileName As String
    FileName = ListDir.Path & _
    IIf(Right$(ListDir.Path, 1) = "", "", "") & listFile.FileName
    'Now we'll cheat to make sure the folder exists,
    'though you're SOL if a file by those names exists.
    If Not FolderChecked Then
    On Error Resume Next
    MkDir "c:projects"
    MkDir "c:projectsparyoll 2"
    MkDir "c:projectsparyoll 2data"
    On Error GoTo 0
    'So it'll only be checked the first time
    FolderChecked = True
    End If

    FileCopy FileName, "c:projectsparyoll 2data" & "prdata.txt" <-- added file name .txt

    End Sub
    [/code]

    Thanks for everyone's help, and I hope what I found can help someone else. Keeping in mind to add the "filename" at the end of the copy destination.

    the darthmoob
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : ok I did some reading and debugging, apparently what you need to do is add a file name at the end of the FileCopy routine. Example:
    :

    Oops, sorry about that; I get it mixed up with the DOS copy command at times... (DOS copy command will let you specify the folder to copy into without the file name if you intend to keep the same filename)
Sign In or Register to comment.