I wrote a macro today for a first time in a few years and it appears to be running slowly. The macro takes a file with a .datalog extension, converts it to .xlsx, open the .xlsx file then performs text to columns on the data in range A:A. The macro works fine but it appear to be slow. If I run the text to columns manually in the workbook, it appears to process much faster than through VBA. I have run the standard Application-level configs to optimise but it still appears to be slow - when run manually, it takes a matter of seconds whereas it takes roughly 1 minute through VBA. My code is below. Is there anything I can add to it to speed it up? Thanks.
Sub SecondAttempt()
Dim oWbk As Workbook
Dim oWbkNew As Workbook
Dim sPath, sFile As String
Dim iWorkbookCount As Integer
Dim sNewFileName As String
'Optimize Macro Speed
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
sPath = ActiveWorkbook.Path & "\data\" 'location of files
sFile = Dir(sPath & "*.datalog") 'change or add formats
' will start LOOP until all files in folder sPath have been looped through
Do While sFile <> ""
' open file
Set oWbk = Workbooks.Open(sPath & "\" & sFile)
' create new name
sNewFileName = sPath & Replace(oWbk.Name, ".datalog", ".xlsx")
' save to xlsx (alerts disabled to allow automatic overwrite)
Application.DisplayAlerts = False
oWbk.SaveAs FileName:=sNewFileName, FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
' close workbook
oWbk.Close True
' open file
Set oWbkNew = Workbooks.Open(sNewFileName)
oWbkNew.Worksheets(1).Columns("A:A").Select
' convert to columns
Selection.TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=True, Space:=True
' close workbook
oWbkNew.Close True
' increment count
iWorkbookCount = iWorkbookCount + 1
sFile = Dir
Loop
'Message Box when tasks are completed
MsgBox "Complete! " & iWorkbookCount & " Workbooks converted"
'Reset Macro Optimization Settings
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
End Sub