LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Excel 2007 export/import datetime

I have an xmlMap with a datetime field mapped to a listColumn, named "Time",
formatted as "[hh]:mm".
My app requires that the "Time" column be in the range "04:00" - "27:59" -
no date. Obviously, anything after midnight will have a date of 1/1/1900.

I export one workbook using this map to an xml file and the xml file says:
<Time1899-12-31T13:00:00.000</Time
or
<Time1900-01-01T02:00:00.000</Time
When I try to import the xml file into my vba workbook the 1899 date is an
invalid date, so it imports it as text.

My workaround is to make both of these workbooks use 1904 date system. I
know, bad idea. But, I am the only one using these 2 workbooks (at least
until I die or retire) and they don't reference other workbooks. So, I figure
I am relatively safe for the moment.

This works fine until I do listColumn("Time").find on a time greater than
23:59. VBA doesn't recognize anything after "23:59" as a valid date, so I
have to subtract 24 from the string and then do a DateAdd("d",1,time)
function. Unfortunately, DateAdd doesn't know that my workbook is using the
1904 date system, so I have had to create my own AddADay function.
This all works, but I hate kludgy workarounds. So, I continue to search for
a better answer.
 
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
Excel 2007 - Developer tab - xml import/export functions biz7 Excel Worksheet Functions 1 June 26th 09 08:27 PM
Import/export netCDF files to Excel Piet Jongejan Excel Discussion (Misc queries) 1 July 22nd 08 12:32 PM
Add Visual Foxpro 9 DBF import / Export to Excel 2007 mua Excel Worksheet Functions 1 August 17th 06 05:09 PM
import and export from SQL SERVER to Excel sal21[_106_] Excel Programming 1 June 14th 06 10:56 AM
import- export XML in excel without loosing XML format Edwin[_2_] Excel Programming 0 January 31st 04 12:31 AM


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