Solved

Urgent, pls help - Open Excel & get cell values

Posted on 2000-05-03
2
203 Views
Last Modified: 2013-12-18
Hi,
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!
0
Comment
Question by:kspuea
2 Comments
 
LVL 3

Accepted Solution

by:
Simon_Hendry earned 80 total points
ID: 2772819
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)
     
     ExcelApp.Range(CellName).Select

     RTString = Cstr(ExcelApp.ActiveCell.Value)
     
     ExcelApp.Quit

     GetCellValue = RTString

End Function


This can be called thus::

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

0
 

Author Comment

by:kspuea
ID: 2772888
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?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IBM Enterprise Integrator - ZID File 1 174
SQL Server linked server to Lotus notes 3 503
DIIOP IP Addresses Changes Automatically 5 93
Domino Website - Redirection 12 84
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question