Hi Steve
Cells should be qualified to the worksheet.
Dim xlWks as excel.Worksheet
' add a new sheet
Set xlWks = xlExcel.Workbooks("myBook.xls").Worksheets.Add
' or an existing sheet
'Set xlWks = xlExcel.Workbooks("myBook.xls").Worksheets.("Sheet 1")
With xlWks
..Range(.Cells(TrackRow, TrackCol), .Cells(TrackRow, TrackCol +
SelectedCount - 1)).HorizontalAlignment = xlCenter
End With
Regards,
Peter T
"Digicelt" wrote in
message ...
HELP
Having a serious problem with CELL qualifications ...
xlExcel.Range(Cells(TrackRow, TrackCol), Cells(TrackRow, TrackCol +
SelectedCount - 1)).HorizontalAlignment = xlCenter
This line, for example, will work fine 1st time through the Access
application to generate an excel sheet, but if you try and re-run
WITHOUT shutting the app down first, gives the error "method 'CELLS' of
object _Global failed", but all other statements using xlExcel seem to
work ok.
XlExcel quits and set to nothing at end of app, so stumped. Someone
mentioned may be an error with CELLS statement. Any takers ...?
Thanks, Steve
--
Digicelt
------------------------------------------------------------------------
Digicelt's Profile:
http://www.excelforum.com/member.php...o&userid=30392
View this thread: http://www.excelforum.com/showthread...hreadid=500545