How to set the mask for a date in excel

HarryK

New Member
Hello,

I am developing a program to write to exel from progress,
using some code like this.

def var h-excel as com-handle no-undo.
def var h-book as com-handle no-undo.
def var h-sheet as com-handle no-undo.
CREATE "Excel.Application" h-Excel.
h-book = h-Excel:Workbooks:Add().
h-Sheet = h-Excel:Sheets:Item(1).

h-sheet:range("A1"):value = "12/31/2007". /* mdy */
h-sheet:range("A1"):Numberformat = "dd-mm-jjjj". /* dutch */

Compile it and distribute it to our customers
It works fine except for that workstation with his/her
international settings set to US america.
Here the output is 31-12-jjjj and not 31-12-2007
Changing it to dd-mm-yyyy works for the US one,
but all workstations with setting Dutch display 31-12-yyyy

Is there a way to determe what excel wants ?
dd-mm-jjjj or dd-mm-yyyy ?

( I had the same problem with dot versus komma in decimals.
Here i found in the windows registry the decimal-separator ,
and used this value to set the mask. )


Thanks in advance,
 
If you have not solved this already, you can try the following:

Code:
CREATE "Excel.Application" chExcelApplication.
chWorkBook = chExcelApplication:WorkBooks:ADD().
chWorkSheet = chExcelApplication:Sheets:ITEM(1).
chExcelApplication:Sheets:ITEM(1):SELECT.
chExcelApplication:cells:Select.
chExcelApplication:cells:NumberFormat = "@".
chWorksheet:Range(mRange):VALUE = STRING (vDate)

The objective is to change the format of the cells to "text" and then export values as string. :)
 
Thanks,
But the problem is , the user wants to sort on this date's

The time being I did it the "nasty programming way":
DEF VAR DateFormat as CHAR INITIAL 'dd-mm-jjjj'.
.......
h-sheet:range('A1'):value = '01/01/1980'.
h-sheet:range('A1'):Numberformat = 'jjjj'.
IF h-sheet:range('A1'):TEXT EQ 'jjjj' THEN DateFormat = 'dd-mm-yyyy'.
.......
This works but .............................:dead:
 
Back
Top