excel borders??

spinkung

Registered User.
Local time
Today, 09:00
Joined
Dec 4, 2006
Messages
267
Hi All,

I am trying to add a botom border to an excel sheet from access vba with....

Code:
xlsht1.Range("A1:AZ1").Borders(xlEdgeBottom).Color = RGB(0, 0, 0)

...but i keep getting an error message saying : application defind or object defined error


can anyone help??

Thanks,
Spin.
 
Hi All,

I am trying to add a botom border to an excel sheet from access vba with....

Code:
xlsht1.Range("A1:AZ1").Borders(xlEdgeBottom).Color = RGB(0, 0, 0)

...but i keep getting an error message saying : application defind or object defined error


can anyone help??

Thanks,
Spin.

I have sometimes had issue with the Range object and borders.

Try using Cells instead:

Code:
xlsht1.Cells(1,52).Borders(xlEdgeBottom).Color = RGB(0, 0, 0)

FYI RGB(0,0,0) is black which is the default color for borders...
 
Hi,

thanks for your reply but unfortunately it still gives the same error???
 
Try:

Code:
xlsht1.Range("A1:AZ1").Borders(9).Color = RGB(0, 0, 0)
 
That's all very well but why 9? and why doesn't XlEdgeBottom work

from help
Index can be one of the following XlBordersIndex constants: xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, or xlEdgeTop, xlInsideHorizontal, or xlInsideVertical.


Brian
 
He's doing it from access and his syntax is correct so I guessed he must be using late binding and therefore can't use excel built in constants. You therefore have to use the intrinsic value of the excel constant which for xledgebottom is 9.

If you need the intrinsic value of any excel constant just open up excel and goto the VBE and in the immediate window type:

Code:
debug.print <constant name>

and this will return the intrinsic value of the constant.
 
:o missed the point that he was doing it from access, and thanks for the other info.

Brian
 

Users who are viewing this thread

Back
Top Bottom