Excel Questions for VB6

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

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

Thanks,
Aaron
 
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
 
Back
Top