Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting Data from Excel

Posted on 2000-05-14
2
Medium Priority
?
140 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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