Solved

Populating Excel Ole With ADO Recordset

Posted on 1999-01-06
3
379 Views
Last Modified: 2013-12-25
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?
0
Comment
Question by:tgoglia
3 Comments
 

Expert Comment

by:T38Jet
ID: 1498790
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.

0
 

Author Comment

by:tgoglia
ID: 1498791
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
0
 
LVL 3

Accepted Solution

by:
altena earned 200 total points
ID: 1498792
A nice alternative is to create a huge string
using "vbTab" (to separate columns) and "vbCRLF"
to go to the next row.

Then you only have to call a "paste" method in excel
and all of the data will be put in as once.

This is MUCH faster than looping aver the recordset
and putting in the values one by one.

Good Luck.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now