Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Urgent, pls help - Open Excel & get cell values

Posted on 2000-05-03
2
Medium Priority
?
209 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

Independent Software Vendors: 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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 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