I
IanWhit
I need to read border values in vbs. But I'm getting inconsistent results. I
can get xlEdgeBottom when it's -4138 and 4. Even when there is no border(Bot,
top,left or right) it is returning 2
borders.value gets me -4142 or nothing (if a border exists it seems).
So is there a better way of doing this?
Or is my syntax wrong
This is just some test code I'm using
-----------------------------------------------------------------------
const xlEdgeBottom = 9
const xlEdgeLeft = 7
const xlEdgeRight = 10
const xlEdgeTop = 8
Set oExcel = CreateObject("Excel.application")
Set obook = oExcel.Workbooks.Open("e:\corp\XCEL\BalanceSheetC.xls")
oExcel.Application.Visible = True
Set osheet = oExcel.Worksheets(1)
intCol = 20
inRow = 1
response.Write "Cell value: " & oExcel.Worksheets(1).Cells(intCol, inRow).
value & "<br><br>"
response.Write "Border bottom value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeBottom).Weight & "<br>"
response.Write "Border right value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeRight).Weight & "<br>"
response.Write "Border left value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeLeft).Weight & "<br>"
response.Write "Border top value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeTop).Weight & "<br>"
oExcel.Application.Quit
Set osheet = Nothing
Set oExcel = Nothing
can get xlEdgeBottom when it's -4138 and 4. Even when there is no border(Bot,
top,left or right) it is returning 2
borders.value gets me -4142 or nothing (if a border exists it seems).
So is there a better way of doing this?
Or is my syntax wrong
This is just some test code I'm using
-----------------------------------------------------------------------
const xlEdgeBottom = 9
const xlEdgeLeft = 7
const xlEdgeRight = 10
const xlEdgeTop = 8
Set oExcel = CreateObject("Excel.application")
Set obook = oExcel.Workbooks.Open("e:\corp\XCEL\BalanceSheetC.xls")
oExcel.Application.Visible = True
Set osheet = oExcel.Worksheets(1)
intCol = 20
inRow = 1
response.Write "Cell value: " & oExcel.Worksheets(1).Cells(intCol, inRow).
value & "<br><br>"
response.Write "Border bottom value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeBottom).Weight & "<br>"
response.Write "Border right value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeRight).Weight & "<br>"
response.Write "Border left value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeLeft).Weight & "<br>"
response.Write "Border top value: " & oExcel.Worksheets(1).Cells(intCol,
inRow).Borders(xlEdgeTop).Weight & "<br>"
oExcel.Application.Quit
Set osheet = Nothing
Set oExcel = Nothing