Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I get the value of a cell in a un-opened workbook ?

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How can I get the value of a cell in a un-opened workbook ?

='[C:\My folder\My File.xls]Sheet3'!A1

You can put that formula in a cell, then replace it with the value returned
(fastest approach). Another:

http://www.j-walk.com/ss/excel/tips/tip82.htm
VBA Function to Get a Value From a Closed File
from John Walkenbach's site.


--
Regards,
Tom Ogilvy


"Oasis" wrote in message
...
Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default How can I get the value of a cell in a un-opened workbook ?

There are several options:
1) Use a linked cell in the new worksheet. General form of the formula
would be:
='Link File.xls'!$A$1 (or whatever cell you want)
If you need to use this value for further calculations, just use the value
in the Range.
2) Open the book (hidden, if desired) and read the cell value using
Automation:
Dim LinkBook as Workbook
Set LinkBook = Workbooks.Open("Link File.xls")
LinkedCellVal = LinkBook.Sheets("LinkSheet").Range("$A$1").Value
LinkBook.Close
Set LinkBook = Nothing
3) Use a database query (either MSQuery or ADO methods in VBA) to read the
value from the closed book. Too complex for a quick explanation, search the
knowledge base/MSDN library for more info.
4) Use DDE (Dynamic Data Exchange) - also a complex subject, will have to
refer you again to MSDN library.

Best way depends on tradeoff of complexity/flexibility



"Oasis" wrote:

Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a workbook if not opened, going to it if already opened neotokyo[_3_] Excel Programming 0 September 24th 04 08:56 PM
Opening a workbook if not opened, going to it if already opened neotokyo[_2_] Excel Programming 1 September 24th 04 07:17 PM
Opening a workbook if not opened, going to it if already opened neotokyo Excel Programming 1 September 24th 04 06:33 PM
How to see if the opened workbook is opened by another user ? balexis Excel Programming 1 August 18th 04 04:11 PM
Sheets select method fails when workbook is opened by another workbook Mike Excel Programming 2 June 8th 04 04:17 AM


All times are GMT +1. The time now is 02:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"