M
mechif
Hi!
I created worksheets from a CSV file using VBScript (Excel 2003).
I want to put a border around the filled cells (UsedRange).
I recorded a macro to put full borders (top, bottom, right, left) and
tried to addapt it to my VBScript.
Where can I get a list of all the xl constants - because they are not
recognized in the VBScript ?
How do I write the code so the borders will work?
Thanks!
Mechi
Set objExcel =
CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Add
wsheetNum = 1
Set objSummarySheet = objWorkbook.Worksheets(wsheetNum)
objSummarySheet.Name = "Summary"
....
....
With
objSummarySheet.UsedRange.borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
I created worksheets from a CSV file using VBScript (Excel 2003).
I want to put a border around the filled cells (UsedRange).
I recorded a macro to put full borders (top, bottom, right, left) and
tried to addapt it to my VBScript.
Where can I get a list of all the xl constants - because they are not
recognized in the VBScript ?
How do I write the code so the borders will work?
Thanks!
Mechi
Set objExcel =
CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Add
wsheetNum = 1
Set objSummarySheet = objWorkbook.Worksheets(wsheetNum)
objSummarySheet.Name = "Summary"
....
....
With
objSummarySheet.UsedRange.borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With objSummarySheet.UsedRange.borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With