none
Path not found RRS feed

  • Question

  • Hello,

    I have a code to Move folder with FSO (FileSystemObject) ,the code worked correctly last week, I do not understand why I get error 76 "path not found" now

    have anyone idea?

    Sub MoveFolder()
    
        Dim FSO As Object
        Dim FromPath As String
        Dim ToPath As String
        Dim myRow As Long
    	    
        myRow = ActiveCell.Row
        
        FromPath = Cells(myRow, 6)
        ToPath = Cells(2, 2) & "\"
        
        Set FSO = CreateObject("Scripting.FileSystemObject")
        
        FSO.MoveFolder Source:=FromPath, Destination:=ToPath
        
        MsgBox "move folder from " & FromPath & " to " & ToPath 
    	
    
    End Sub

    Best regards,

    Neven


    • Edited by Req_En Thursday, June 14, 2018 7:12 AM
    Thursday, June 14, 2018 7:11 AM

Answers

  • The most plausible explanation is that either FromPath or ToPath does not contain a valid folder path.

    You could insert lines

    Debug.Print FromPath
    Debug.Print ToPath

    and check the result in the Immediate window.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Req_En Thursday, June 14, 2018 10:44 AM
    Thursday, June 14, 2018 8:32 AM

All replies

  • The most plausible explanation is that either FromPath or ToPath does not contain a valid folder path.

    You could insert lines

    Debug.Print FromPath
    Debug.Print ToPath

    and check the result in the Immediate window.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Req_En Thursday, June 14, 2018 10:44 AM
    Thursday, June 14, 2018 8:32 AM
  • Hello Hans,

    Thank u very much , I found space in my link.

    Best regards,

    Neven

    Thursday, June 14, 2018 10:45 AM