Notifications
Clear all

[Closed] OLE Syntax

Hi,

I’m trying to write a script using an OLE Excel object and I’m stuck on some syntax.
I have the following code which works for putting a border around the range of cells.

(thisWorksheet.range "A1" "D1").Borders.Linestyle = -4119

However I really want only the bottom edge of the cells to be affected. According to MSDN

Worksheets(1).Range("A1").Borders(xlEdgeBottom).LineStyle = xlDouble 

I should be able to add a index to Borders to affect only the bottom edge however I’m not sure what the syntax is to do this. I guessed this would work but it doesn’t

(thisWorksheet.range "A1" "D1").(Borders 9).Linestyle = -4119

where 9 is the constant for xlEdgeBottom. Any idea? I’ve tried just about everything I can think of.

Thanks,
Rod

1 Reply

Ok figured it out. Shifted the “(” in front of Borders to the beginning of the line.


  ((thisWorksheet.range "A1" "D1").Borders 9).Linestyle = -4119