Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Date format error with CSV file

Hi,

Using Excel 2007

I have a csv file that when opened manually has the correct date
format of DD/MM/YYYY

When I open the file with VBA, the date format defaults to MM/DD/YYYY,
some of the dates come through as text fields.

Even importing this through VBA as a text file (with .csv extension)
and changing the format to D/M/Y it still comes in as MM/DD/YYYY and
some of the fields being text, when I change the extension to ".txt"
it imports OK

I do not want to have my code renaming the files to .txt in order to
get the correct date format

Any help on this would be greatly appreciated

Regards
Raymond Allan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Date format error with CSV file

On Jan 28, 10:22*pm, FmEdit wrote:
Hi,

Using Excel 2007

I have a csv file that when opened manually has the correct date
format of DD/MM/YYYY

When I open the file with VBA, the date format defaults to MM/DD/YYYY,
some of the dates come through as text fields.

Even importing this through VBA as a text file (with .csv extension)
and changing the format to D/M/Y it still comes in as MM/DD/YYYY and
some of the fields being text, when I change the extension to ".txt"
it imports OK

I do not want to have my code renaming the files to .txt in order to
get the correct date format

Any help on this would be greatly appreciated

Regards
Raymond Allan


Is this something you can fix by making the appropriate adjustment in
your Regional Settings under Control Panel ?

Otherwise you might have to manipulate all the date values in your VBA
code.

AP
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Date format error with CSV file

On 28 Jan, 12:02, AP wrote:
On Jan 28, 10:22*pm, FmEdit wrote:





Hi,


Using Excel 2007


I have a csv file that when opened manually has the correct date
format of DD/MM/YYYY


When I open the file with VBA, the date format defaults to MM/DD/YYYY,
some of the dates come through as text fields.


Even importing this through VBA as a text file (with .csv extension)
and changing the format to D/M/Y it still comes in as MM/DD/YYYY and
some of the fields being text, when I change the extension to ".txt"
it imports OK


I do not want to have my code renaming the files to .txt in order to
get the correct date format


Any help on this would be greatly appreciated


Regards
Raymond Allan


Is this something you can fix by making the appropriate adjustment in
your Regional Settings under Control Panel ?

Otherwise you might have to manipulate all the date values in your VBA
code.

AP- Hide quoted text -

- Show quoted text -


My regional settings are all set to UK format (default)

The frustrating part is when it is manually opened, all the date
fields are in the correct format, by using VBA to open the file it
defaults to the US format and any date that has the day 12 becomes a
text field

RA
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Date format error with CSV file

Il 28/01/2010 15.20, FmEdit ha scritto:
On 28 Jan, 12:02, wrote:
On Jan 28, 10:22 pm, wrote:





Hi,


Using Excel 2007


I have a csv file that when opened manually has the correct date
format of DD/MM/YYYY


When I open the file with VBA, the date format defaults to MM/DD/YYYY,
some of the dates come through as text fields.


Even importing this through VBA as a text file (with .csv extension)
and changing the format to D/M/Y it still comes in as MM/DD/YYYY and
some of the fields being text, when I change the extension to ".txt"
it imports OK


I do not want to have my code renaming the files to .txt in order to
get the correct date format


Any help on this would be greatly appreciated


Regards
Raymond Allan


Is this something you can fix by making the appropriate adjustment in
your Regional Settings under Control Panel ?

Otherwise you might have to manipulate all the date values in your VBA
code.

AP- Hide quoted text -

- Show quoted text -


My regional settings are all set to UK format (default)

The frustrating part is when it is manually opened, all the date
fields are in the correct format, by using VBA to open the file it
defaults to the US format and any date that has the day 12 becomes a
text field

RA


Menu Data - Text to Column (I think so in english version)

--
Ciao BlackSun
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Date format error with CSV file

On 28 Jan, 14:29, BlackSun wrote:
Il 28/01/2010 15.20, FmEdit ha scritto:





On 28 Jan, 12:02, *wrote:
On Jan 28, 10:22 pm, *wrote:


Hi,


Using Excel 2007


I have a csv file that when opened manually has the correct date
format of DD/MM/YYYY


When I open the file with VBA, the date format defaults to MM/DD/YYYY,
some of the dates come through as text fields.


Even importing this through VBA as a text file (with .csv extension)
and changing the format to D/M/Y it still comes in as MM/DD/YYYY and
some of the fields being text, when I change the extension to ".txt"
it imports OK


I do not want to have my code renaming the files to .txt in order to
get the correct date format


Any help on this would be greatly appreciated


Regards
Raymond Allan


Is this something you can fix by making the appropriate adjustment in
your Regional Settings under Control Panel ?


Otherwise you might have to manipulate all the date values in your VBA
code.


AP- Hide quoted text -


- Show quoted text -


My regional settings are all set to UK format (default)


The frustrating part is when it is manually opened, all the date
fields are in the correct format, by using VBA to open the file it
defaults to the US format and any date that has the day *12 becomes a
text field


RA


Menu Data - Text to Column (I think so in english version)

--
Ciao BlackSun- Hide quoted text -

- Show quoted text -


The text to column is my current workaround, I was hoping for a
solution that would not invlove having to manipulate the data.

RA


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Date format error with CSV file

On 28 Jan, 14:51, "michdenis" wrote:
Hi,

Try this :

Workooks.Open Filename:="c:\Excel\MyFile.csv",Local:=True


Perfect, thank you very much


Regards
Raymond Allan


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
file format or file extension is not valid...error message Ballun Excel Discussion (Misc queries) 0 May 7th 09 09:06 PM
How can I get date of file creation to XLS cell in date format? Radek Simek Excel Worksheet Functions 3 November 8th 07 04:24 PM
Copy/Paste dates from CSV file - date format error? michael.beckinsale Excel Programming 6 May 12th 07 11:05 AM
Concatenate error and Date Format Error Coal Miner Excel Programming 3 April 26th 06 10:30 PM
Error:Invalid File format,while opening an Excel Template file Saurabh Excel Programming 1 January 17th 05 07:15 AM


All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"