ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Questions for VB6 (https://www.excelbanter.com/excel-programming/276210-excel-questions-vb6.html)

Aaron[_8_]

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

Thanks,
Aaron



Bob Phillips[_5_]

Excel Questions for VB6
 
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



--

HTH

Bob Phillips

"Aaron" <NONE wrote in message ...
How can you connect to an Excel spread sheet via VB6 (not VBA) to retrieve
information from specfic cells?

Thanks,
Aaron







All times are GMT +1. The time now is 06:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com