I'm looking to save a .csv file as an .xlsx file using VBA.
My VBA seems to disrupt the file when I change the file name from name.csv
to name.xlsx
and shows the following message when I try to open it:
Sub SaveAnalysis()
ArrearsAnalysis = "Early Arrears Analysis"
For Each wb In Application.Workbooks
If wb.Name Like ArrearsAnalysis & "*" Then
Set AnalysisWB = Workbooks(wb.Name)
End If
Next wb
Application.DisplayAlerts = False
AnalysisWB.SaveAs Replace(AnalysisWB.FullName, ".csv", ".xlsx")
AnalysisWB.Close True
Application.DisplayAlerts = True
End Sub
Can someone see the issue and steer me in the right direction?