I've had a problem to keep the formatting when opening a csv-file in Excel 2007. Looked around in excel-forums only to find one possible solution. Change file-extension from csv to txt.
Tried to make a Function as general as possible. Here it is:
Option Explicit
Function ChangeFileExt(filnamn As String, extensionOld, extensionNew)
Dim oldname, newname as string
oldname = ThisWorkbook.Path & "\" & filnamn & "." & extensionOld
newname = ThisWorkbook.Path & "\" & filnamn & "." & extensionNew
Name oldname As newname
End Function
'...............................................................................
Sub change_extension()
' Objective: Want to keep csv-format at workbook.open
' Rename file from filename.csv to filename.txt
' Open txt-file
' process data
' Rename back to csv-file if neccesary
Dim csv, txt As String
csv = "csv"
txt = "txt"
Call ChangeFileExt("file_name_to_change", csv, txt) ' omit extension in file_name_to_change
...all kinds of code
Call ChangeFileName("file_name_to_change", txt, csv) ' change filename back to original name
End Sub
DIRto open the file. Give it a try and if you get stuck simply post the code that you tried and we will take it from there