Click to See Complete Forum and Search --> : Align in excel


dammansky
May 17th, 2001, 02:45 AM
Can anybody help me with the alignment in excel (i create an excel file from VB 6.0)

newbook.worksheets(1).range("A1:Z6").Align ????

Thanx

Cakkie
May 17th, 2001, 07:01 AM
You can use the horizontalalignment and the verticalalignment properties of the range.

newbook.worksheets(1).range("A1:Z6").HorizontalAlignment = xlCenter



Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

Iouri
May 17th, 2001, 07:06 AM
Dim xlSheet as Excel.Worksheet

xlApp.Visible = true

set xlWorkbook = xlApp.Workbooks.Add

set xlSheet = xlWorkbook.Sheets(1)

With xlSheet.Cells(1, 1)
.Value = "Hello"
.HorizontalAlignment = xlCenter ' Center
.HorizontalAlignment = xlRight ' Right Align
.HorizontalAlignment = xlLeft ' Left Align

.VerticalAlignment = xlBottom ' Bottom
.VerticalAlignment = xlCenter ' Center
.VerticalAlignment = xlTop ' Top

End With

xlWorkbook.Close false

xlApp.Quit



Iouri Boutchkine
iouri@hotsheet.com