[AccessD] Excel Code

Bob Heygood bheygood at abestsystems.com
Mon Aug 4 14:10:49 CDT 2003


Hey to the Group,

I have found some great code to go to an excel sheet and total a column. It
works in excel fine. But when I try and adapt it to automate excel from
Access, I get errors for the "Cells(xxxx)" object. I have been successful in
instancing the Excel application and the Excel workbook. I have tried to
understand the cell thing but cannot get the Excel object model to show up
in the object browser in Access.

So, how do I get this to work in Access. And, how can one explore the excel
model from Access.

Code:

Dim cRows As Long

    cRows = Cells(Rows.Count,"A").End(xlUp).Row
    Cells(cRows+1,"A").FormulaR1C1 = "=SUM(R1C1:R[-1]C1)"

This is for column A, change the "A" and C1 if a different column required.

Code End:

TIA

Bob




More information about the AccessD mailing list