|
-
April 9th, 2001, 08:59 PM
#1
How to use Alignment (Center, etc) a cell in an Excell Sheet using VB code?
Hiya all,
Quick question? How to align a cell in an excell sheet using VB code? Thanx for you help!
-
April 9th, 2001, 09:37 PM
#2
Re: How to use Alignment (Center, etc) a cell in an Excell Sheet using VB code?
The following example shows how to set Horizontal and vertical alignment
Dim xlApp as new Excel.Application
Dim xlWorkbook as Excel.Workbook
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
Hope this helps,
Nathan Liebke
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|