Solved

Populating Excel Ole With ADO Recordset

Posted on 1999-01-06
3
412 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

688 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