Pete
The following should do what you need...
Sub Open_CSV_Format_Save_Close()
Application.ScreenUpdating = False
Workbooks.Open Filename:="C:\My Documents\SourceFile.csv"
''
'formatting actions
Range("A1:C1").Font.Bold = True
''
ActiveWorkbook.SaveAs Filename:="C:\My Documents\CreatedFile.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close
MsgBox "File has been opened, formatted and saved."
End Sub
Thx for your help JAF, unfortunately this saves the file back to XLS format, I need to be able to format the file and then save it as a CSV file once again....The problem occurs when the macro saves the file as FileFormat:=xlCSV.
Any Ideas ??
This should do the trick...
Pete
Try this. The line Application.DisplayAlerts = False will disable any alerts that Excel normally throws up. It's VERY important to put in the line at the end of the macro to set Alerts back to True!!
JAF
Sub Open_CSV_Format_Save_Close()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Open Filename:="C:\My Documents\SourceFile.csv"
''
'formatting actions
Range("A1:C1").Font.Bold = True
''
ActiveWorkbook.SaveAs Filename:="C:\My Documents\CreatedFile.csv", _
FileFormat:=xlCSV, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "File has been opened, formatted and saved."
End Sub
Re: This should do the trick...
Many Thanks for your help - that works fine :)
Pete.