?
Solved

Urgent, pls help - Open Excel & get cell values

Posted on 2000-05-03
2
Medium Priority
?
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Simon_Hendry earned 240 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

752 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