Solved

Getting Data from Excel

Posted on 2000-05-14
2
137 Views
Last Modified: 2010-05-02
I wish to import data from a named cell
in Excel 2000.

Say the cell is A1

I dont wish to open Excel only take the number stored in the Cell and use it in my VB Program

I am a beginner using VB 6
0
Comment
Question by:kennys
[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 14

Accepted Solution

by:
wsh2 earned 50 total points
ID: 2808419
Try this..
------------------------------------

   Dim xlsApp As Object
   Set xlsApp = CreateObject("excel.application")
   xlsApp.Visible = False
   xlsApp.workbooks.Open "c:\MyPath\MyFile.XLS"

   msgbox xlApp.Cells(1, 1)

------------------------------------

0
 
LVL 17

Expert Comment

by:calacuccia
ID: 2808422
Hi Kennys,

You can't get an Excel sheet cell value without opening it.

Try this module:

Sub ReplaceHTMLcharacters()
Dim xl As Object
Dim MyVar As String
Set xl = CreateObject("Excel.Application")
xl.Visible = False
xl.Workbooks.Open "C:\Mijn documenten\Computers Question_bestanden\GoodChartMarks.xls"
Set wb = xl.Workbooks("GoodChartMarks.xls")
MyVar = wb.Sheets("Sheet1").Cells(1, 1).Value
xl.Application.Quit
MsgBox (MyVar)
End Sub

Change path and workbook name, and sheet name to your needs and test it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

623 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