Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default opening worksheet

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default opening worksheet

Forgot to say, the file is in csv format.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default opening worksheet

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default opening worksheet

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default opening worksheet

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
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
Opening Worksheet Mike Excel Discussion (Misc queries) 1 October 17th 06 04:21 PM
VBA Opening worksheet, name changes Jeff Excel Discussion (Misc queries) 5 September 20th 05 06:00 PM
Opening a New Worksheet PT New Users to Excel 1 April 13th 05 01:43 AM
OPening worksheet teresa Excel Programming 1 December 12th 04 09:19 PM
Opening a worksheet in VBA gwgeller Excel Programming 3 January 28th 04 07:06 PM


All times are GMT +1. The time now is 12:39 PM.

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

About Us

"It's about Microsoft Excel"