I am new to VBA, I have pieced together the following code to convert all .xls files to .xlsx in a folder and delete old .xls files.
I ran it and it worked...now it does not. Now I get a Runtime error 53 'File not found', the code hangs at the Kill command after successfully saving the file. Any ideas?
Sub ConvertToXlsx()
    Dim strPath As String
    Dim strFile As String
    Dim wbk As Workbook
    ' Path must end in trailing backslash
    strPath = "C:\Work Docs\Command and Control\Test\"
    strFile = Dir(strPath & "*.xls")
    Do While strFile <> ""
        If Right(strFile, 3) = "xls" Then
            Set wbk = Workbooks.Open(Filename:=strPath & strFile)
            ActiveSheet.Name = "NewName" 
            wbk.SaveAs Filename:=strPath & strFile & "x", _
                FileFormat:=xlOpenXMLWorkbook
            wbk.Close SaveChanges:=False
            If Right(strFile, 3) = "xls" Then
            
            Kill strFile
            
            End If
        End If
        strFile = Dir
    Loop
End Sub
 
    