Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening CSV files in Excel with VBA.

Status
Not open for further replies.

longmot

Programmer
Apr 22, 2002
11
GB
I am getting different results with different users when using opening csv files in excel from vba command.

User 1. All date fields are open with dd/mm/yyyy format. The same when opening the file manually.

User 2. All date fields are open with dd/mm/yyyy format when opened manually but
when opened in vba using: Workbooks.Open filename:="xxx.csv"
some dates are in text format with US style dates but a few are in UK style and recognised as dates in the correct dd/mm/yyyy format.

Anyone know how this can vary between users?
 
Your users can have different preferences set as to how they interpret dates.

What you might look into is when writing away the dates to the CSV file write them away as integer values, and in the macro used to open the CSV sheet format the columns as dates.

Assuming that they're read only values that is, otherwise the headaches haven't started - if they write back different format dates, bring on the Prozac ;)
 
Yes I think I'll look into changing the csv file. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top