Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I access an unopened spreadsheet from a program?

Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are already
open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I access an unopened spreadsheet from a program?

VBA doesn't support that. You can use an excel 4 macro command. You can
put a linking formula in a cell, and read the value returned, then clear the
formula (usually the fastest). You can use ADO to treat the closed workbook
as a data base. You can open the workbook, get the data, then close it.

Probably other ways as well.

--
Regards,
Tom Ogilvy


"Pete at Sappi Fine Paper"
wrote in message ...
Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are already
open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default How do I access an unopened spreadsheet from a program?

try this....

Sub test()

Dim x As Excel.Workbook

Set x = Workbooks.Open("c:\book4.xls")
End Sub

Swap "book4.xls" for your workbook name.

Good luck.

--
www.alignment-systems.com


"Pete at Sappi Fine Paper" wrote:

Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are already
open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I access an unopened spreadsheet from a program?

Thanks John. Unfortunately this solution opens the spreadsheet in question,
which I am trying to avoid. It's a huge spreadsheet and takes forever to
open. I need to access the data in the spreadsheet without opening it.

"John.Greenan" wrote:

try this....

Sub test()

Dim x As Excel.Workbook

Set x = Workbooks.Open("c:\book4.xls")
End Sub

Swap "book4.xls" for your workbook name.

Good luck.

--
www.alignment-systems.com


"Pete at Sappi Fine Paper" wrote:

Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are already
open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I access an unopened spreadsheet from a program?

Thanks Tom. I was afraid of that. If it won't take too long to explain,
what is ADO?

"Tom Ogilvy" wrote:

VBA doesn't support that. You can use an excel 4 macro command. You can
put a linking formula in a cell, and read the value returned, then clear the
formula (usually the fastest). You can use ADO to treat the closed workbook
as a data base. You can open the workbook, get the data, then close it.

Probably other ways as well.

--
Regards,
Tom Ogilvy


"Pete at Sappi Fine Paper"
wrote in message ...
Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are already
open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default How do I access an unopened spreadsheet from a program?

Pete at Sappi Fine Paper shared this with us in
microsoft.public.excel.programming:

Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are
already open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete


Read this page:

Copy a range from closed workbooks (ADO)
http://www.rondebruin.nl/ado.htm

And this also:
http://www.rondebruin.nl/tips.htm

It's not a direct answer to your question, but a good workaround.

--
Amedee Van Gasse
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default How do I access an unopened spreadsheet from a program?

"Pete at Sappi Fine Paper"
skrev i melding ...
Thanks Tom. I was afraid of that. If it won't take too long to explain,
what is ADO?


Hi Pete

ActiveX Data Objects -a great common set of objects for all kinds of
databases. See Carl Prothman's site
http://www.carlprothman.net/Default.aspx?tabid=80
for expert insight, and
http://erlandsendata.no/english/inde...dacimportwbado
on how to use this with Excel as a database.

HTH. Best wishes Harald


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I access an unopened spreadsheet from a program?

http://msdn.microsoft.com/library/de...mmersguide.asp

--
Regards,
Tom Ogilvy


"Pete at Sappi Fine Paper"
wrote in message ...
Thanks Tom. I was afraid of that. If it won't take too long to explain,
what is ADO?

"Tom Ogilvy" wrote:

VBA doesn't support that. You can use an excel 4 macro command. You

can
put a linking formula in a cell, and read the value returned, then clear

the
formula (usually the fastest). You can use ADO to treat the closed

workbook
as a data base. You can open the workbook, get the data, then close it.

Probably other ways as well.

--
Regards,
Tom Ogilvy


"Pete at Sappi Fine Paper"


wrote in message

...
Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are

already
open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How do I access an unopened spreadsheet from a program?

Thanks!

"Amedee Van Gasse" wrote:

Pete at Sappi Fine Paper shared this with us in
microsoft.public.excel.programming:

Hi folks.

The Workbooks keyword only seems to work for spreadsheets that are
already open. I can't seem to say, for example:

wkb = Workbooks("Y:\Downloads\6-7.xls")

So how do I refer to cells in that spreadsheet without opening it?

Any help would be much appreciated! :)

-Pete


Read this page:

Copy a range from closed workbooks (ADO)
http://www.rondebruin.nl/ado.htm

And this also:
http://www.rondebruin.nl/tips.htm

It's not a direct answer to your question, but a good workaround.

--
Amedee Van Gasse

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
Access program golfmancan Excel Discussion (Misc queries) 2 August 5th 08 04:52 PM
Move a spreadsheet to an unopened workbook thegentree Excel Worksheet Functions 0 August 15th 06 11:36 PM
any way to access data in unopened excel chengkithung Excel Discussion (Misc queries) 1 March 17th 06 04:58 PM
Excel/Access Program Dan[_36_] Excel Programming 1 June 24th 04 12:12 PM
Calling Access Program from Excel John Baker Excel Programming 1 April 24th 04 01:20 PM


All times are GMT +1. The time now is 03:07 PM.

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

About Us

"It's about Microsoft Excel"