Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Populating Excel Ole With ADO Recordset

Posted on 1999-01-06
3
Medium Priority
?
421 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 400 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

597 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