Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Why are some dates changing and not others?

If I were you, I would change the file extension of what you are
attempting to import from .csv to .txt (you can do this manually in
Wondows Explorer or code it into VBA) and then open it using
Workbooks.OpenText where you can specify how to interpret columns (see
the VBA help - eg D/M/Y order etc).

Richard



C Flynn wrote:
I have a routine that imports data from a csv file into an xls file which
contains the import code. The data i'm importing contains a colunm which
contains dates. "01/03/2002 00:00" (without the speech marks). for some
reason when the following code opens the file, some dates have changed. for
example the above date becomes "03/01/2002 00:00:00" this problem is driving
me crazy because it only affects somes dates but not all so i can't change my
code to reverse the month and day around. Please help.

Hers the code i'm using:
Sub StockP()
'
Dim Target As Workbook
Dim Source As Workbook
Dim FName As String
Dim MyPath As String
MyPath = "C:\Stacker"
Set Target = ThisWorkbook
ChDrive MyPath
ChDir MyPath
FName = Dir("*.csv")
If Len(FName) = 0 Then
MsgBox "Stock file not found" & vbNewLine & "Try Exporting a used stock
file from Pinnacle to C:\Stacker folder first"
Exit Sub
End If
'
Application.ScreenUpdating = False
If Len(FName) = 90 Then
Workbooks.Open Filename:=FName
etc



--
C Flynn
UK


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
Changing dates MICHALK Excel Discussion (Misc queries) 6 January 28th 10 05:13 PM
Stop UK-style dates changing to US-style dates when mailmerging. Jean XO Excel Discussion (Misc queries) 1 December 20th 07 12:35 PM
changing dates. chesty Excel Worksheet Functions 1 June 14th 06 03:04 PM
Changing Dates IanC Excel Programming 3 January 2nd 06 12:31 PM
Changing Dates JohnG Excel Discussion (Misc queries) 2 May 17th 05 06:22 PM


All times are GMT +1. The time now is 10:50 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"