Solved

Urgent, pls help - Open Excel & get cell values

Posted on 2000-05-03
2
198 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Lotus Notes Calendar Issue 5 101
IBM SAN DS 3512 Controllers Networking issues 11 33
Lotus Domino server 9 7 64
Domino Lotus Notes Client 4 66
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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now