PDA

Click to See Complete Forum and Search --> : excel


hbarker
Dec 28th, 1999, 10:48 PM
We are trying to read an excel file from our application. We are wanting to read a certain column. Is there a way to do this??

RogerH
Dec 29th, 1999, 12:06 AM
No problem, if you have MS Excel on that machine:

Select in menu Project - References the MS Excel Object Library"

suppose the value is in cell C8 in file c:\temp\test.xls your code is:

Dim objExcel As Excel.Application
Dim readvar As Variant

Set objExcel = New Excel.Application
objExcel.Workbooks.Open "c:\temp\test.xls", , True
readvar = objExcel.Range("c8").Value
objExcel.Quit
Set objExcel = Nothing

MsgBox readvar


RogerH