Hi everyone,
I'm getting error when running the following vbscript that formats an Excel sheet. It complains that object doesn't support the property "Selection.Bord ers".
Is the code for adding borders correct?
I'm getting error when running the following vbscript that formats an Excel sheet. It complains that object doesn't support the property "Selection.Bord ers".
Is the code for adding borders correct?
Code:
Dim objXL
Dim boolXL
Dim objActiveWkb
Dim filePath
filePath = "C:\Test.xls"
Set objXL = CreateObject("Excel.Application")
objXL.Application.Workbooks.Open (filePath)
Set objActiveWkb = objXL.Application.ActiveWorkbook
objActiveWkb.Application.DisplayAlerts = False
With objXL
.Range("A1:H1").Select
.Selection.Interior.ColorIndex = 15
End With
With objXL
.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objXL
.Sheets("Tabelle 1").Select
.Columns.AutoFit
End With
objActiveWkb.Save
Comment