Click to See Complete Forum and Search --> : Changing cell attributes in excel


dammansky
August 31st, 2001, 04:11 AM
Hi,

i am making an excel file from visual basic With the following code:

Dim newbook as Variant
set newbook = X.Workbooks.Add
newbook.worksheets(1).range("A1").Value = "bla"
newbook.worksheets(1).range("A1").Font.Bold = true



This works fine, but there are a few things that i don't know how to do:

Changing column width and row height
changing the cell backcolor

Could anybody help me please?

Cimperiali
August 31st, 2001, 04:41 AM
'xlsheet here is newbook.worksheets(1) in your code
'xlapp is the variable that istantiate excel.application
'ie:
'private withevents xlApp as Excel.Application

xlSheet.Range("A1").Value = "bla"
xlSheet.Range("A1").Font.Bold = true

xlSheet.Columns("A:A").ColumnWidth = 17.43
xlSheet.Rows("1:1").RowHeight = 15
xlSheet.Range("A3").Select
With xlApp.Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With




Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater