I have updated my VBA for Excel script to convert the .xls file to the .xlsx format. Haven't been successful at creating the table before the save. Got the range, but the ActiveSheet.ListObjects.Add(xlSrcRange, Range(Cells(1, 1), Cells(lRow, lCol)), , xlYes).Name = "Table1" is failing, perhaps a hierarchy issue. Below is the code, just not sure where to put that code; have tried a couple of places.
Sub CovertToXlsx(ByVal vFilePath)
Dim iSeconds
iSeconds = 20
Set xlApp = CreateObject("excel.application")
With xlApp.Workbooks.Open(vFilePath) 'open file
With .ActiveSheet
'Set a freeze under column 1 so that the header is always present at the top
.Range("A2").Select
xlApp.ActiveWindow.FreezePanes = True
'Get Range Info from A1:A1 to SlRow:SlCol
lRow = .Cells(Rows.Count, "A").End(xlUp).Row
lCol = .Cells(1, Columns.Count).End(xlToLeft).Column
End With
'WScript.Sleep iSeconds * 1000 '20 * 1 second
Timeout (10)
xlApp.DisplayAlerts = False
'.SaveAs Left(vFilePath, Len(vFilePath) - 4) & ".xlsx", -4143 '-4143=xlWorkbookNormal
.SaveAs Left(vFilePath, Len(vFilePath) - 4) & ".xlsx", 51
.Close True 'save and close
xlApp.DisplayAlerts = True
End With
xlApp.Quit
Set xlApp = Nothing
End Sub
Nevertheless, I will try the flow suggestions you mentioned.
-Reba