A Aaron Sep 5, 2003 #1 How can you connect to an Excel spread sheet via VB6 (not VBA) to retrieve information from specfic cells? Thanks, 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 Sep 5, 2003 #2 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
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