dagoose
Feb 19th, 2004, 04:56 AM
Hi All,
I am trying to link fields from a recordset to specific cells within an excel worksheet. For example;
"select * from test_table" returns:
row1 row2 row3
a b c
d e f
I would like to be able to say that the value from record 1 , row 1 is in cell A1 of an excel worksheet.
This is what i am using so far;
Dim dbCH As Database, rsCH As DAO.Recordset
Dim CHApp As Object
Set dbCH = CurrentDb
Set rsCH = dbCH.OpenRecordset("test_table2", dbOpenDynaset)
Set CHApp = CreateObject("Excel.Application")
CHApp.Visible = True
Dim chwb As Excel.Workbook
Dim chws1 As Excel.worksheet
Set chwb = Excel.Workbooks.Add
Set chws1 = Excel.Worksheets.Add
chws1.Range("A1").Value = "Test"
------------------------------------------------ problem here ---------------
'chws1.Range("A2").CopyFromRecordset (rsCH)
---------------------------------------------------------------------------------
any help appreciated
I am trying to link fields from a recordset to specific cells within an excel worksheet. For example;
"select * from test_table" returns:
row1 row2 row3
a b c
d e f
I would like to be able to say that the value from record 1 , row 1 is in cell A1 of an excel worksheet.
This is what i am using so far;
Dim dbCH As Database, rsCH As DAO.Recordset
Dim CHApp As Object
Set dbCH = CurrentDb
Set rsCH = dbCH.OpenRecordset("test_table2", dbOpenDynaset)
Set CHApp = CreateObject("Excel.Application")
CHApp.Visible = True
Dim chwb As Excel.Workbook
Dim chws1 As Excel.worksheet
Set chwb = Excel.Workbooks.Add
Set chws1 = Excel.Worksheets.Add
chws1.Range("A1").Value = "Test"
------------------------------------------------ problem here ---------------
'chws1.Range("A2").CopyFromRecordset (rsCH)
---------------------------------------------------------------------------------
any help appreciated