>Hello all
>
>I want to draw a grey fill column B2 and i want to set the WIDTH Of the column B to be 60 how to set it
Akhan,
I assume 60 for width is in pixels. There are 2 properties used in column width, WIDTH and COLUMNWIDTH. One is in chars and the other is in points. You could convert to points but you can't set using columnwidth (I don't know why, according to docs it shouldn't be readonly but it fails). To use other you should get the width in chars.
For color setting you could also use .Color = rgb(). However Excel has a color palette and it's a little probability the color you choose would match. It'd pick nearest from its palette. So use ColorIndex instead.
Local lnPixels,lnOneChar
lnPixels = 60
oExcel = Createobject('Excel.Application')
With oExcel
.Workbooks.Add
With .ActiveSheet
With .Range('A1').Font
lnOneChar = Txtwidth('0',.Name,.Size) * Fontmetric(6,.Name,.Size)
Endwith
With .Range('B:B')
.ColumnWidth = Int(lnPixels/lnOneChar)
.Interior.ColorIndex = 15
Endwith
Endwith
.Visible = .T.
Endwith
PS:It's almost impossible to get exact pixels for columnwidth. For rowheight you can.
Cetin