I have some coding that works well with Excel 2010 on windows XP. Just tried the following code on windows 7 and 8.1. Coming up with Compile error. Can't find project or Library.

The attached code seems to crash at the Left Command. If I delete that portion then it does not recognize fdlr. Any thoughts how to bring this code to be compatible with Windows 8.1

Sub Create_Files()


    Dim FSO As Object
    Dim FromPath As String
    Dim ToPath As String
    Dim NewJobNum  As String
    Dim NewSite  As String
  

    NewJobNum = Sheets(1).Cells(8, 4)
    NewSite = Left(Sheets(1).Cells(9, 4), 6)
    
    MsgBox "Select the folder You want new set of files created in"
    
    With Application.FileDialog(msoFileDialogFolderPicker)
        .InitialFileName = Len(ActiveWorkbook.Path) - 1 '.InitialFileName = ActiveWorkbook.Path & "\"
        .Show
    If .SelectedItems.Count = 0 Then GoTo 1
1        fdlr = .SelectedItems(1)

 End With
 
    Unload UserForm1
    
    FromPath = ActiveWorkbook.Path & "\Templates" '<< Change
    ToPath = fdlr & "\" & NewJobNum 'Note: It is not possible to use a folder that exist in ToPath
    
    
    If Right(FromPath, 1) = "\" Then
        FromPath = Left(FromPath, Len(FromPath) - 1)
    End If

    If Right(ToPath, 1) = "\" Then
        ToPath = Left(ToPath, Len(ToPath) - 1)
    End If

    Set FSO = CreateObject("scripting.filesystemobject")

    If FSO.FolderExists(FromPath) = False Then
        MsgBox FromPath & " doesn't exist"
        Exit Sub
    End If

    If FSO.FolderExists(ToPath) = True Then
        MsgBox ToPath & " exist, not possible to move to a existing folder"
        Exit Sub
    End If

    FSO.CopyFolder Source:=FromPath, Destination:=ToPath
        
    Name ToPath & "\01 Job## Labour xsitex" As ToPath & "\01 Job " & NewJobNum & " Labour " & NewSite
    Name ToPath & "\02 Job## Elect Orders xSitex" As ToPath & "\02 Job " & NewJobNum & " Elect Orders " & NewSite
    Name ToPath & "\03 Job## Elect Used xSitex" As ToPath & "\03 Job " & NewJobNum & " Elect Used " & NewSite
    Name ToPath & "\04 Job## Instr Orders xSitex" As ToPath & "\04 Job " & NewJobNum & " Instr Orders " & NewSite
    Name ToPath & "\05 Job## Instr Used xSitex" As ToPath & "\05 Job " & NewJobNum & " Instr Used " & NewSite
    Name ToPath & "\06 Job## Material Credit Back xSitex" As ToPath & "\06 Job " & NewJobNum & " Material Credit Back " & NewSite
    Name ToPath & "\07 Job## Back Orders" As ToPath & "\07 Job " & " Back Orders " & NewSite
    Name ToPath & "\Labour Tickets V2.0.xlsm" As ToPath & "\" & NewJobNum & " Labour Tickets V2.0.xlsm"
    Name ToPath & "\Elec Material Order V2.0.xlsm" As ToPath & "\" & NewJobNum & " Elec Material Order V2.0.xlsm"
    Name ToPath & "\Elec Material Used V2.0.xlsm" As ToPath & "\" & NewJobNum & " Elec Material Used V2.0.xlsm"
    Name ToPath & "\Inst Material Order V2.0.xlsm" As ToPath & "\" & NewJobNum & " Inst Material Order V2.0.xlsm"
    Name ToPath & "\Inst Material Used V2.0.xlsm" As ToPath & "\" & NewJobNum & " Inst Material Used V2.0.xlsm"
    Name ToPath & "\Material Credit V2.0.xlsm" As ToPath & "\" & NewJobNum & " Material Credit V2.0.xlsm"
    Name ToPath & "\Back Orders V2.0.xlsm" As ToPath & "\" & NewJobNum & " Back Orders V2.0.xlsm"
    
    'This deletes the command button to create a new job
    ActiveSheet.Shapes.Range(Array("CommandButton1")).Select
    Selection.Delete

    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:= _
        ToPath & "\Setup-Job V2.0.xlsm", _
        FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
   Application.DisplayAlerts = True

End Sub