# Re: drawing borders in excel

**URL:** <https://www.ruby-forum.com/t/re-drawing-borders-in-excel/77731>\
**Category:** Ruby\
**Created:** [November 30, 2006, 2:14am UTC](https://www.ruby-forum.com/t/re-drawing-borders-in-excel/77731 "2006-11-30T02:14:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@bbiker](https://www.ruby-forum.com/u/bbiker)\
**Post date:** [November 30, 2006, 2:14am UTC](https://www.ruby-forum.com/t/re-drawing-borders-in-excel/77731/1 "2006-11-30T02:14:07Z")

</div>

Okay quick update… I figured out how to change the color of my border  
and it shows up:

worksheet.Range(“a#{currRow}:d#{currRow}”).Borders[‘ColorIndex’] = 3

Buuuut when I try to change the line weight or style I get an OLE error.  
Neither of these work:

worksheet.Range(“a#{currRow}:d#{currRow}”).Borders[‘LineStyle’] =  
‘xlContinuous’  
worksheet.Range(“a#{currRow}:d#{currRow}”).Borders[‘Weight’] = ‘xlThick’

The OLE error says unable to set the Weight property of the Borders  
class. Same for Line Style. This makes me think that maybe the values I  
am trying to set it to are incorrect since this also happens when I try  
to change the color index to something like 99. So I believe I am  
accessing the property correctly but not setting the correct value,  
however all the examples I could find use those values.  
Any ideas?

#####################################################################################################  
place the following lines in your script after the line where you open  
the excel application

module ExcelConst  
end  
WIN32OLE.const\_load(excel, ExcelConst)

then you can use XlThick and XlContinuous as constants … note buene:  
capital X not lowercase

fairly sure that quotes are not needed

ps XlThick = 4, XlContinuous = 1
