Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel spreadsheet to Access Table

Status
Not open for further replies.

Aristarco

Programmer
Jun 19, 2000
77
0
0
MX
Hi there. I've been using the next code to tranfer an excel spreadsheet to Access so I can make relations, etc...
Code:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "MyTable", "MySheet.xls", True [\code]

But now, I have to make it in VB 6.0, so my utility is a .exe file. I've connected to the .xls file. Now what? How do I open the sheet and get the info to pass it to a recordset? Is there an equivalent of VBA's TransferSpreadsheet in VB?

To boldly code, where no programmer has compiled before!
 
Hi,

What you need to do is set a reference to Excel x.0.

Then you will have all the Excel objects, properties, methods including TransferSpreadsheet.

After setting the reference in the VB Editor, in you code use CreateObject to create and instance of Excel...
Code:
dim xlApp as Excel.Application
reference.
    
Set xlApp = CreateObject("excel.application")

xlApp.workbooks.Open  ...
:)

Skip,
Skip@TheOfficeExperts.com
 
What I want to do is to open a spreadsheet and store the data in a recordset, so I can transfer it to a table in an *.mdb file. I'll try your code. Thank you very much.

To boldly code, where no programmer has compiled before!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top