Urgent, pls help - Open Excel & get cell values

I need some sample coding on how to open an existing MS Excel file, and get the cell value out to a variable.

Pls help if you have sample on this...
It's very urgent. I have to complete it by tomorrow.
Thanks very much!
Who is Participating?
Simon_HendryConnect With a Mentor Commented:
Here is a function to get the cell value from the specified file

Function GetCellValue(CellName As String,FileName As String) As String

     Dim RTString As String

     Set Chart = CreateObject("Excel.Sheet")
     Set ExcelApp = Chart.Application.Application
     ExcelApp.Visible = False
     Call ExcelApp.WorkBooks.Add(FileName)

     RTString = Cstr(ExcelApp.ActiveCell.Value)

     GetCellValue = RTString

End Function

This can be called thus::

Data = GetCellValue("C3","book3.xls")

kspueaAuthor Commented:
Thanks a lot, Simon!!

But I still don't quite understand why you want to write the following lines:

Set ExcelApp = Chart.Application.Application
ExcelApp.Visible = False
Call ExcelApp.WorkBooks.Add(FileName)

Is it opening MS Excel application and make it invisible?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.