Open a recordset from excel with VB6

Posted on 2005-03-02
Medium Priority
Last Modified: 2013-12-25
I need to get data from Excel to a recordset.
I found this code on the Internet, but I don't know what to do from here... How do I go from here to a recordset?  Is there a better way to do this?

oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
           "DriverId=790;" & _
           "Dbq=c:\somepath\mySpreadsheet.xls;" & _

I plan to take this data and validate it and base on the validation, this data from excel will go into an access database if it passes the validation, while the errors will go into an error spreadsheet in Excel.  Although I worte the validation loop, I cannot use it because I don't know how many rows the spreadsheet has from where I get the data, each spreadsheet has a differnet number of rows.  I need to use a for loop for i=2 to rows.columns.count (this doesn't work either) so I thought I would use for i = 2 to recordset.EOF.  But I don't know how to get the recordset.  Can you please help me!!!
Question by:Angie532
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
LVL 53

Accepted Solution

Dhaest earned 2000 total points
ID: 13447224
SAMPLE: ExcelADO Demonstrates How to Use ADO to Read and Write Data in Excel Workbooks


Expert Comment

ID: 13451200

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 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