Hi,
I wonder if any one can help me? I am trying to save an Excel Worksheet as a tab delimited txt file using Access VBA. I need to get the file into text format so I can then Import it into Access (The data is pretty naf so need the functionality of an Importspec).
I have created something that’s does most of the job, but it mucks up the date fields for some reason i.e. the date 15/01/2007 (dd/mm/yyyy), but when I save it, the format changes to 1/15/2007. This causes Import error problems!
However, when I go into Excel and save the file as txt delimited manually, the dates stay in the same format.
I have attached the code I'm using below. Am I way of the mark in terms of how I should be doing this? Any advice will be appreciated.
If strType = "IMPORT_TXT" Then
Set objXL = New Excel.Application
Set objWkb = objXL.Workbooks.Open(fs.Foundfiles(i))
objWkb.SaveAs StrFileSave, xlUnicodeText 'tried all types of properties, none seem to do the trick?
objWkb.Close False
Thanks in advance
Nic
I wonder if any one can help me? I am trying to save an Excel Worksheet as a tab delimited txt file using Access VBA. I need to get the file into text format so I can then Import it into Access (The data is pretty naf so need the functionality of an Importspec).
I have created something that’s does most of the job, but it mucks up the date fields for some reason i.e. the date 15/01/2007 (dd/mm/yyyy), but when I save it, the format changes to 1/15/2007. This causes Import error problems!
However, when I go into Excel and save the file as txt delimited manually, the dates stay in the same format.
I have attached the code I'm using below. Am I way of the mark in terms of how I should be doing this? Any advice will be appreciated.
If strType = "IMPORT_TXT" Then
Set objXL = New Excel.Application
Set objWkb = objXL.Workbooks.Open(fs.Foundfiles(i))
objWkb.SaveAs StrFileSave, xlUnicodeText 'tried all types of properties, none seem to do the trick?
objWkb.Close False
Thanks in advance
Nic