Assume the date comes into column 3, then:
columns(3).Numberformat = "yyyy-mm-dd hh:mm:ss"
If it doesn't work doing it before, then do it after the data is imported
and interpreted.
--
Regards,
Tom Ogilvy
"ssingh" wrote:
> I am working on a QTP script which executes sybase queries and exports the
> results to an excel. The recordset sometimes has date values, numbers with
> leading zeroes etc.
>
> To ensure that the format of all the values is retained after results are
> exported to excel , I used the following code:-
>
> ExcelObj.selection.NumberFormat = "@" to change the format of the excel to
> 'text'.
>
> Inspite of using the above code the date format is getting changed :-
>
> Sybase query originally returns date in format : 'yyyy-mm-dd hh:mm: ss' .
> When this value is pasted on excel it gets changed to 'mm/dd/yyyy'.
>
> Need help to fix this! Any suggestions?
>
> TIA
|