Welcome! Log In Create A New Profile

Advanced

WD24: set type of column in Excel

Posted by ArieM 
WD24: set type of column in Excel
October 08, 2021 12:55PM
Hi,

Using xlsDocument and xlsCell and so on, I have a routine to export data.
The columns in Excel are always of the general type.
I want to set the type of a Excel column explicitly to short date or long date of numeric.

The help however says about xlsCell.Type "This property is available in read-only." and indeed when trying to change the type of a cell, it throws an error. Same thing for xlsCOlumn.DefaultCell

Are there other ways to set the type of an Excel column?

Arie
Re: WD24: set type of column in Excel
October 09, 2021 12:36AM
Hi Arie,

use object Automation, then you can do everything ; for example

xl is object Automation "Excel.Application" // Create OLE object

...


xl>>ActiveSheet>>columns("I:I")>>select()
xl>>Selection>>NumberFormat = "0.00"

regards, Heinz
Re: WD24: set type of column in Excel
October 09, 2021 03:16PM
Thanks Heinz

that works.

Arie
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: