Excel Questions for VB6

A

Aaron

How can you connect to an Excel spread sheet via VB6 (not VBA) to retrieve
information from specfic cells?

Thanks,
Aaron
 
B

Bob Phillips

Aaron,

Big question. Essentially, it is the same as you would do from VBA. Create
an in stance of Excel, and then navigate through the Excel object model

Dim xlApp As Object
Dim xlWorkbook As Object
Dim xlSheet As Object

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWorkbook = xlApp.Workbooks.Open("C:\myTest\myFile.xls")
Set xlSheet = xlWorkbook.Worksheets(1)
MsgBox xlSheet.Range("A1")

xlApp.Quit

Set xlApp = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top