I'm no pro, but here are some comments ...
I think you have to open the workbook, but you can make it invisible! The following may help you ...I think you can extract information out of a closed book ... I extracted information into Excel from an Access database without opening the database, but that was a long time ago.Code:Option Explicit Sub Macro1() Dim abook As Workbook 'Open an existing workbook - you'll need error handling if it is already open! Workbooks.Open Filename:="C:\Documents and Settings\guawd1\Desktop\JUNK-TABS-1.xls" 'The book you just opened is now the Active Workbook - set a handle for it Set abook = ActiveWorkbook 'MsgBox abook.Windows.Count 'Make the book disappear! abook.Windows(1).Visible = False 'Access something out of the hidden book MsgBox abook.Sheets(1).Name & " | " & abook.Sheets(1).Range("A1").Value 'Close the hidden book Application.DisplayAlerts = False abook.Close Application.DisplayAlerts = True End Sub
Hey! I just found some old notes. I used DAO. I also found some notes on "Import data from a closed workbook (ADO)". Unfortunately the link to the document seems to be dead now (edc.bizhosting.com/english/adodao.htm). I have a printed copy of it. It's about 50 lines ... too much to type right now ... Try this link:
http://www.mrexcel.com/archive2/30100/34328.htm




Reply With Quote