Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I have a worksheet that contains a column of dates. If I double
click to open, or use File-Open etc, the dates format ok. I want to open using vba, so I recorded a macro, but when I run the macro, some dates format ok, august dates, others format as usa, september dates. then code I used is Workbooks.Open Filename:= _ "C:\Documents and Settings\Robert\Desktop\FOOTBALL\Soccer Predictions\E0.csv". Any ideas please. Regards Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Forgot to say, the file is in csv format.
|
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Usually problems like this are attributed to different type an d amount of
white spaces (spaces, tabs, other non-printable characters). You may need to add to your macro some additionals code such as trim or substitue tabs for nothing. "RobcPettit" wrote: Hi, I have a worksheet that contains a column of dates. If I double click to open, or use File-Open etc, the dates format ok. I want to open using vba, so I recorded a macro, but when I run the macro, some dates format ok, august dates, others format as usa, september dates. then code I used is Workbooks.Open Filename:= _ "C:\Documents and Settings\Robert\Desktop\FOOTBALL\Soccer Predictions\E0.csv". Any ideas please. Regards Robert |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In xl2003+ (maybe xl2002???), there's a "local:=true" parm that you can pass to
the workbooks.open line. It'll use the regional settings (under control panel) for the date format. If you don't have that parm in your version of excel, then maybe you could rename the file from *.csv to *.txt. Then you can specify what each field should be--including the date order (mdy or dmy or...). RobcPettit wrote: Hi, I have a worksheet that contains a column of dates. If I double click to open, or use File-Open etc, the dates format ok. I want to open using vba, so I recorded a macro, but when I run the macro, some dates format ok, august dates, others format as usa, september dates. then code I used is Workbooks.Open Filename:= _ "C:\Documents and Settings\Robert\Desktop\FOOTBALL\Soccer Predictions\E0.csv". Any ideas please. Regards Robert -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thankyou both for your replys. I used the "local:=true" parm. Worked a
treat. It always amazes me as to how simple the solution can be. Thanks for pointing it out. Regards Robert On 20 Nov, 16:58, Dave Peterson wrote: In xl2003+ (maybe xl2002???), there's a "local:=true" parm that you can pass to the workbooks.open line. It'll use the regional settings (under control panel) for the date format. If you don't have that parm in your version of excel, then maybe you could rename the file from *.csv to *.txt. Then you can specify what each field should be--including the date order (mdy or dmy or...). RobcPettit wrote: Hi, I have a worksheet that contains a column of dates. If I double click to open, or use File-Open etc, the dates format ok. I want to open using vba, so I recorded a macro, but when I run the macro, some dates format ok, august dates, others format as usa, september dates. then code I used is Workbooks.Open Filename:= _ "C:\Documents and Settings\Robert\Desktop\FOOTBALL\Soccer Predictions\E0.csv". Any ideas please. Regards Robert -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Opening Worksheet | Excel Discussion (Misc queries) | |||
VBA Opening worksheet, name changes | Excel Discussion (Misc queries) | |||
Opening a New Worksheet | New Users to Excel | |||
OPening worksheet | Excel Programming | |||
Opening a worksheet in VBA | Excel Programming |