|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
FillColor and Border Help in excel
Trying to fill a color (yellow) and set a border (bottom) on the first row in an excel sheet from a vbscript. I don't get any errormessages with the fill color, but neither does the color appear. With the borders I get the errormessage "unknown runtime error"...can someone help?
---------------- Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Open("h:\csvtoexcel\dust.xls") With objExcel '------ FillColor ------ .Range("A1").Select With objExcel.Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With '------ Set Borders ------ .Range("A1").Select .Selection.Borders(xlDiagonalDown).LineStyle = xlNone '<--- error message "unknown runtime error" .Selection.Borders(xlDiagonalUp).LineStyle = xlNone .Selection.Borders(xlEdgeLeft).LineStyle = xlNone .Selection.Borders(xlEdgeTop).LineStyle = xlNone With objexcel.Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With .Selection.Borders(xlEdgeRight).LineStyle = xlNone .Selection.Borders(xlInsideVertical).LineStyle = xlNone end with |
|
#2
|
|||
|
|||
|
Figured out the color thing myself... replaced xlSolid with 1, and whoops....the first row is yellow
![]() |
|
#3
|
||||
|
||||
|
You can't use the 'xl' Constants in the code, you need to replace them with their corresponding numbers ...
For example: Code:
.Range("A1").Select
.Selection.Borders(5).LineStyle = -4142 '<--- error message "unknown runtime error"
.Selection.Borders(6).LineStyle = -4142
.Selection.Borders(7).LineStyle = -4142
.Selection.Borders(8).LineStyle = -4142
With objexcel.Selection.Borders(9)
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End With
.Selection.Borders(10).LineStyle = -4142
.Selection.Borders(11).LineStyle = -4142
__________________
Come JOIN the party!!! Quote of the Month: Retirement: Because you've given so much of yourself to the company that you don't have anything left we can use. Questions to Ponder: What do you do when you see an endangered animal eating an endangered plant? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#4
|
|||
|
|||
|
Thanks!!
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > FillColor and Border Help in excel |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|