PDA

Click to See Complete Forum and Search --> : Vb And Excel File ( read a1 cell val )


daylor
Nov 17th, 2001, 12:44 PM
I need help . ( who doesn't..)

how can i do this thing:

through vb app.
open an excel document and read the value in a1 cell.

that'all.

have a nice day.

Edneeis
Nov 17th, 2001, 06:33 PM
Try This:

Dim appExcel As Excel.Application
Set appExcel = New Excel.Application

Dim sFileName As String
Dim sA1 As String

sFileName = "C:\Documents and Settings\Ed\My Documents\Judy.xls"

appExcel.Workbooks.Open sFileName

Dim actSheet As Excel.Worksheet

MsgBox appExcel.ActiveWorkbook.ActiveSheet.Range("A1").Value

appExcel.Workbooks(appExcel.ActiveWorkbook.Name).Close
appExcel.Quit

Set appExcel = Nothing


By the way you'll have to set a reference to the MS Excel Object first.