View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bruno Campanini[_3_] Bruno Campanini[_3_] is offline
external usenet poster
 
Posts: 52
Default Basic VBA question...

"mattsvai" wrote in
message ...

Thanks for the reply,

unfortunately I still get the nasty "Subscript out of range" error when
I do that:

var = Workbooks("C:\User1.xls").Worksheets("Record").Ran ge("A2")

ARRGG!


No way for Excel VBA to read closed workbooks unless you
create a DAO/ADO recordset from the closed file.

If your need is for a single cell reading you can send the formula
='C:\YourDirectory\[yourfile.xls]Sheet1'!A1
to a cell and then read that cell.

e.g.
[H90].Formula = "='C:\Document\Excel\XLS\[BBCC.xls]Sheet1'!E15"
MsgBox [H90]

Bruno