View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
colmkav colmkav is offline
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.