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: 1
Default VB: date format in an Excel file


Dear All,

I got this requirement to export a date string to an Excel file
from VB application. The short date format in each PC's Regioal
Options could be different. When the VB reads the date string
from MSSQL in "MM/dd/yyyy", the application will export it like:

dFormat = GetUserLocaleInfo(LCID, LOCALE_SSHORTDATE)
dS = CDate(Format(itm.SubItems(15), "MM/dd/yyyy"))
xl.Cells(2, 16) = Format(dS, dFormat)


The problem that I am facing is, although the cell format is set
to be "dd-MMM-yy" like "14-Mar-98", there are two types of values
in the column: e.g. "28/09/2005" or "06-Dec-04". After I double
clicked on the cell, "28/09/2005" will then be displayed as
"28-Sep-05".

Is there anyway to show a consistent date format? Could we
control it from the VB program?

TIA!


--
qqxz
------------------------------------------------------------------------
qqxz's Profile: http://www.excelforum.com/member.php...o&userid=30773
View this thread: http://www.excelforum.com/showthread...hreadid=504407

 
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
2000 shared file excel date format on two different computers airnet Setting up and Configuration of Excel 1 December 12th 08 08:45 PM
File always opens with Date format set - Excel 2007 ale Excel Discussion (Misc queries) 0 December 30th 07 02:55 PM
when loading csv file to Excel, cells get converted to date format RB Excel Discussion (Misc queries) 3 February 14th 07 07:54 AM
Date format not correct when you convert a CSV text file in Excel Scarab Excel Discussion (Misc queries) 2 November 16th 05 12:22 PM
how to merge a date file into an excel format massachusetts Excel Discussion (Misc queries) 1 April 26th 05 02:41 AM


All times are GMT +1. The time now is 07:57 PM.

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"