WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Set Cell Borders and Font


;Initialize Constants
xlEdgeBottom = 9
xlEdgeLeft = 7
xlEdgeRight = 10
xlEdgeTop = 8
xlContinuous = 1
xlThick = 4
xlThin = 2
xlAutomatic = -4105
xlInsideHorizontal = 12
xlInsideVertical = 11
xlUnderlineStyleNone = -4142

objXL = ObjectOpen("Excel.Application")
objXL.Visible = @TRUE
objWorkbooks=objXL.WorkBooks
objWorkbooks.Open("C:\Temp\Data\Test1.xls")
objCell=objXL.Cells(2,2)
objCell.Select
objSelection=objXL.Selection

objBorders = objSelection.Borders(xlEdgeLeft)
objBorders.LineStyle = xlContinuous
objBorders.Weight = xlThin
objBorders.ColorIndex = xlAutomatic

objBorders = objSelection.Borders(xlEdgeTop)
objBorders.LineStyle = xlContinuous
objBorders.Weight = xlThin
objBorders.ColorIndex = xlAutomatic

objBorders = objSelection.Borders(xlEdgeBottom)
objBorders.LineStyle = xlContinuous
objBorders.Weight = xlThin
objBorders.ColorIndex = xlAutomatic

objBorders = objSelection.Borders(xlEdgeRight)
objBorders.LineStyle = xlContinuous
objBorders.Weight = xlThin
objBorders.ColorIndex = xlAutomatic

objBorders = objSelection.Borders(xlInsideVertical)
objBorders.LineStyle = xlContinuous

objBorders = objSelection.Borders(xlInsideHorizontal)
objBorders.LineStyle = xlContinuous

objFont = objSelection.Font
objFont.Name = "Arial"
objFont.Size = 8
objFont.Strikethrough = @False
objFont.Superscript = @False
objFont.Subscript = @False
objFont.OutlineFont = @False
objFont.Shadow = @False
objFont.Underline = xlUnderlineStyleNone
objFont.ColorIndex = xlAutomatic

ObjectClose(objFont)
ObjectClose(objBorders)
ObjectClose(objSelection)
ObjectClose(objCell)
ObjectClose(objWorkbooks)
ObjectClose(objXL)

Article ID:   W16107
File Created: 2004:03:30:15:42:54
Last Updated: 2004:03:30:15:42:54