Link to home
Start Free TrialLog in
Avatar of tgoglia
tgoglia

asked on

Populating Excel Ole With ADO Recordset

I have opened an excel worksheet object in my VB application and am attempting to populate it from an ADO recordset, and allow the user to print out the results. What is the method to import the data into the excel chart? When I run the application, all of the usual Excel menu items are there excepr for the File menu, which includes the Print command. How do I allow the user to print the date in the chart after they have formatted it?
Avatar of T38Jet
T38Jet

that's several questions....

' Here's how you plug in the ADO recordset value
objExcel.Application.ActiveWorkbook.Worksheets("Sheet1").Rows(1).Cells(1).Value = rstRecords.Fields("Field1").Value

If your chart is based on a pivot table which gets its data from "Sheet1", it will automatically appear in the chart.

Avatar of tgoglia

ASKER

Thanks for your help. Your code proved that I had the right idea, the problem was that I thought that when I created the OLE object, I assumed that the appropriate code libraries would automatically be added to the project. An incorrect assumption.
tgoglia
ASKER CERTIFIED SOLUTION
Avatar of altena
altena

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial