Solved

Getting Data from Excel

Posted on 2000-05-14
2
136 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

738 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