Hi

I'm using SQL2000 and trying to convert a macro (which formats data in an Excel spreadsheet) into an activeX script to run in a dts package
I get an error on line marked with asterix below as activex doesn't recognise Excel sheets - any ideas how I could rewrite this

Cheers


Dim oRange As Range
Dim oCell As Range

'Format Records
Errors.Select '**********Error here *********

'Change colour of column header and format borders...
Range("A3:G3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone

With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With

Range("A3").Value = "ID"
Range("A3").Select
Format_Column_Header
Range("B3").Value = "IDTYPE"
Range("B3").Select
Format_Column_Header
Range("C3").Value = "No"
Range("C3").Select
Format_Column_Header
Range("D3").Value = "CATEGORY"
Range("D3").Select
Format_Column_Header
Range("E3").Value = "TYPE"
Range("E3").Select
Format_Column_Header
Range("F3").Value = "FORENAME"
Range("F3").Select
Format_Column_Header
Range("G3").Value = "SURNAME"
Range("G3").Select
Format_Column_Header



'Change row colours and font
Set oRange = Range("A4", Range("G65536").End(xlUp))
oRange.Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Interior
.ColorIndex = 2
.Pattern = xlNone
End With
With Selection.Font
.ColorIndex = 1
.Bold = False
End With

Set oRange = Range("B4", Range("B65536").End(xlUp))
For Each oCell In oRange
oCell.Value = oCell.Value
Next oCell

Set oRange = Range("C4", Range("C65536").End(xlUp))
For Each oCell In oRange
oCell.Value = oCell.Value
Next oCell



'Adjust column widths
Columns(1).AutoFit
Columns(2).AutoFit
Columns(3).AutoFit
Columns(4).AutoFit
Columns(5).AutoFit
Columns(6).AutoFit
Columns(7).AutoFit