|
-
January 11th, 2000, 07:34 AM
#1
Help in EXCEL
Help! How can I draw borders in excel with visual basic? So that i can form tables...
eg. changing the font to BOLD " excelsheet.range("A1:C1").Font.Bold = True "
anyone can help? PLS
-
January 11th, 2000, 09:06 AM
#2
Re: Help in EXCEL
The absolute best way to do this is to go to Excel, start recording a macro, and draw the borders yourself.
Then take that code, and move it to your VB project.
For example:
Dim objXL as new Excel.Application
With objXL
.Workbooks.Add
Range("A1:B5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Visible = true
End With
Hope that helps...
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
|