I've trailed through the search here and also google but can't seem to find an answer..
Is it possible to apply borders to cells in Excel through VB? I've tried what I normally do in Excel - record a macro then copy the code from the editor and put my Excel object name in front of it.
The following code is straight from Excel VBA:
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
I've amended this:
excel_sheet.Selection.Borders("xlDiagonalDown"
.LineStyle = "xlNone"
excel_sheet.Selection.Borders("xlDiagonalUp"
.LineStyle = "xlNone"
With excel_sheet.Selection.Borders("xlEdgeLeft"
.LineStyle = "xlContinuous"
.Weight = "xlThin"
.ColorIndex = "xlAutomatic"
End With
Error message is:
"Object doesn't support this property or method"
Any help much appreciated
Regards,
pmrankine
Is it possible to apply borders to cells in Excel through VB? I've tried what I normally do in Excel - record a macro then copy the code from the editor and put my Excel object name in front of it.
The following code is straight from Excel VBA:
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
I've amended this:
excel_sheet.Selection.Borders("xlDiagonalDown"
excel_sheet.Selection.Borders("xlDiagonalUp"
With excel_sheet.Selection.Borders("xlEdgeLeft"
.LineStyle = "xlContinuous"
.Weight = "xlThin"
.ColorIndex = "xlAutomatic"
End With
Error message is:
"Object doesn't support this property or method"
Any help much appreciated
Regards,
pmrankine