Hi,
I'm trying to format an entire column in an excel file before exporting data to excel. I'm doing the follwoing but it is not working as I expect. Am I doing wrong?
I want to get the result (Number Type = Custom, formatted date = 'Mon, Mar 18, 2013 00:00') by formatting the entire column. (strFormat='ddd, mmm dd, yyyy hh:mm')
The following code formats the date value correctly, but I have to set the numberformat property for each cell. (The resulting Number Type is Custom 'ddd, mmm dd, yyyy hh:mm', and resulting cell value is 'Mon, Mar 18, 2013 00:00')
objExcelSheet.Range(intRow, intCol).DateTime = dtDateTime
objExcelSheet.Range(intRow, intCol).NumberFormat = strFormat
The following code formats the date in a default Date format in excel (The resulting Number Type is Date '*3/14/2001' and resulting cell value is '3/18/2013')
objExcelSheet.Range(intRow, intCol).DateTime = dtDateTime
objExcelSheet.Columns(intCol).NumberFormat = strFormat
or
objExcelSheet.Columns(intCol).CellStyle.NumberFormat = strFormat
Thanks in advance.