
OLE, VB3, access cells from many sheets in a single .XLW workbook
Quote:
>How do I access cells in Visual Basic 3 from many spreadsheets which are
>contained in a single Excel 5 .XLW workbook file? I'm using OLE
>automation to do that.
>I have no problem accessing cells within a single .XLS file.
>I have searched the online help files (VB 3 and XL 5, not any XL
>development kits) and manuals and tried various crazy ideas, but I'm
>stuck. Any help?
>--
I have never used VB3, but I have used the following in 16 bit VB4.
Dim xl As Excel.Application
Dim xlb As Excel.Workbook
Dim xls1 As Excel.Worksheet
Dim xls2 As Excel.Worksheet
Set xl = CreateObject("Excel.Application")
Set xlb = xl.Workbooks.Open("C:\MODELS\SCRIPTS\OUTPUT2.XLS")
Set xls1 = xlb.Worksheets("Sheet1")
Set xls2 = xlb.Worksheets("Sheet2")
MyVar1 = xls1.Range("A1").Value
xls1.Range("K5").Value = "Blah"
MyVar2 = xls2.Range("A1").Value
xls2.Range("K5").Value = "Blah"
_________________________________________
Mike Thompson
BHP NZ Steel
Auckland
New Zealand
_________________________________________