Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date problem Excel VBA 1

Status
Not open for further replies.

robcarr

Programmer
May 15, 2002
633
GB
Hi,
i have a Lucent cvsautofile that I import into excel each day using

Code:
aname = ActiveWorkbook.Name
ddate = [c1].Value
pname = "P:\reports\Temp\Flash " & Format(ddate, "ddmmyy") & ".xls"
Workbooks.OpenText FileName:=pname, Origin:= _
        437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
        ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
        , Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
        TrailingMinusNumbers:=True

if I open the above file using excel in the same way the date will show as dd/mm/yy

but if I run the recorded code above it enters the date as mm/dd/yy

anyone know why this is and any way to get round it without having to find dates in the data and then reformat them.




Hope this is of use, Rob.[yoda]
 
FieldInfo:=Array(1, 1)
Only one field ?
FieldInfo:=Array(1, 4) ' 4=xlDMYFormat

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
got it to work, thanks
phv

Hope this is of use, Rob.[yoda]
 
come across another problem with this,

some of the standard number fields are also converted to date, it is strange as not all are.

any ideas

Hope this is of use, Rob.[yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top