View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Potters Max Potters is offline
external usenet poster
 
Posts: 43
Default Access and retrieve data from network workbook

Dave (and others),

I tried to use the GetValue code on the website
(http://j-walk.com/ss/excel/eee/eee009.txt), and added a few changes for my
personal use. here is the code:

Sub GetDataFromClosedFile()
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
'''
path = "C:\Documents and Settings\Max\Desktop\"
file = "test.xls"
sheet = "Sheet1"
range_ref = "A1"
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
'''
Cell = "'" & path & "[" & file & "]" & sheet & "'!" & Range(range_ref).Value
MsgBox ExecuteExcel4Macro(Cell)
MsgBox "Cell = " & Cell
Sheet1.Range("A1").Value = Cell
End Sub

This code doesn't work. I commented the Msgbox line Execute...., and then
used another MsgBox "Cell = " & Cell. No errors here, but the messagebox
shows me just the path, file, sheet (and no cell value!!!!), and in
sheet1.range("A1").value I find the same.

THE PROBLEM:

How can I make sure that the cell value in my file (test.xls), comes in my
active workbook (where this code is)? The syntax of the line Cell = "'" &
path...etc.... is ok, but I think VB sees this as text, and I want to
extract the value of a cell!

Please help, thanks in advance

Max


"Dave Peterson" wrote in message
...
you could use a technique on John Walkenbach's site:

http://j-walk.com/ss/excel/eee/eee009.txt
Look for either: GetDataFromClosedFile or GetValue.

Max Potters wrote:

Hi,

I'm having a problem with retrieving data from a workbook on another PC,
that is, a network PC. I want to copy some cell values from the network

PC,
into a local workbook. I know a simple way to do it, but this needs the
"network workbook" to be open.

I want to access the network workbook and retrieve and store data, but
without opening the workbook!

Please help me. If anything is not clear, please reply and I'll give

further
details.

Thanks in advance

Max Potters
The Netherlands


--

Dave Peterson