opening worksheet

R

RobcPettit

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
 
G

Guest

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.
 
D

Dave Peterson

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...).
 
R

RobcPettit

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top