Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Date format/value different when opening manually compare to VBA macro



<<<<<<<Regardless, I would think that Workbooks.Open (as you did originally) would
simply pass the information to Excel to open the workbook. Therefore, I
would not think that would cause the cell to look differently in Excel (if
that is what you mean), unless Workbooks.Open chooses a different default
format for dates. (Seems unlikely.)

In any case, even if the __appearance__ of the date is different, I would
expect the actual date value assigned to a type Double variable or viewed
with a Number format would be the same.

The actual value itself is different when I open it via VBA macro (workbooks.open). ie 41220 and 41101 if you convert to a number. There my code which is evaluating the value treats it as a different date. (7/11/2012 instead of 11/7/2012)

<<<<<<<<More importantly (perhaps; depends on context), what does Month(...the
date...) return in VBA?

I indeed call the month function and get it returned as 11 instead of 7.

What I mean by visually is that when I step through the VBA code as look at opened file in Excel the date i 7/11/2012. If I just open the file manually in excel it is 11/7/2012.

Anyway, using workbooks.opentext after changing name to a txt file works fine it seems. So happy to use this.
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
Incorrect date format when opening txt or csv files via macro proberts Excel Programming 1 May 5th 06 02:10 PM
Compare dates (one cell not in date format) craigcsb Excel Discussion (Misc queries) 5 June 28th 05 05:07 PM
switched date format opening dbf file [email protected] Excel Programming 1 July 16th 04 01:13 PM
Date format when opening a .CSV file programmatically jason Excel Programming 3 November 10th 03 09:09 AM
Opening Add-in files manually Tim Childs Excel Programming 2 September 26th 03 11:27 AM


All times are GMT +1. The time now is 05:28 AM.

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"