ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unwanted date conversion when opening a workbook (https://www.excelbanter.com/excel-programming/300152-unwanted-date-conversion-when-opening-workbook.html)

Rob

Unwanted date conversion when opening a workbook
 
I have a document, saved as text from another application (business objects) which contains the value 01/06/2004 (1st June 2004) in cell A5

When I open the workbook mannually I see the correct date, but when I open it with code (workbooks.open("path.xls")) it comes up with 01/06/200

Any help

Thank
Rob

Tom Ogilvy

Unwanted date conversion when opening a workbook
 
What version of Excel.

How do you open it in code?

Generally, VBA treats a date as US format if it can. Excel 2002 had some
additional options/settings to handle this as I recall.

--
Regards,
Tom Ogilvy

"Rob" wrote in message
...
I have a document, saved as text from another application (business

objects) which contains the value 01/06/2004 (1st June 2004) in cell A5.

When I open the workbook mannually I see the correct date, but when I open

it with code (workbooks.open("path.xls")) it comes up with 01/06/2004

Any help?

Thanks
Rob




keepITcool

Unwanted date conversion when opening a workbook
 

if it's a text file you could/should open it:

set wb=workbooks.opentext("path.txt")

see opentext method in vba help for all the params you can set.

some of the array settings may seem complicated, _
but just give it a few tries with the macrorecorder running ...



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


?B?Um9i?= wrote:

I have a document, saved as text from another application (business
objects) which contains the value 01/06/2004 (1st June 2004) in cell
A5.

When I open the workbook mannually I see the correct date, but when I
open it with code (workbooks.open("path.xls")) it comes up with
01/06/2004

Any help?

Thanks
Rob




All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com