Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
workbooks.open - another option
I will be accessing several workbooks (test.xls, test1.xls, ...).
What is the syntax to "reference" workbook without having to open it? thanks -Mona Set wbkTarget = Workbooks.open(Filename:="c:\ test.xls") If wbkTarget Is Nothing Then MsgBox "Can not open file" Else Set wksTarget = wbkTarget.Sheets("Summary") If wksTarget Is Nothing Then MsgBox "Could not locate sheet" Else lRow_2006 = Sheets("Summary").Range("A" & _ Sheets("Summary").Rows.count).End(xlUp).Row End If End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
workbooks.open - another option
You mean to retrieve values from cells on a worksheet?
You can use helper cells in a worksheet and build formulas to do the work or You could retrieve values from a closed workbook using a routine from John Walkenbach: http://j-walk.com/ss/excel/eee/eee009.txt Look for either: GetDataFromClosedFile or GetValue. Mona wrote: I will be accessing several workbooks (test.xls, test1.xls, ...). What is the syntax to "reference" workbook without having to open it? thanks -Mona Set wbkTarget = Workbooks.open(Filename:="c:\ test.xls") If wbkTarget Is Nothing Then MsgBox "Can not open file" Else Set wksTarget = wbkTarget.Sheets("Summary") If wksTarget Is Nothing Then MsgBox "Could not locate sheet" Else lRow_2006 = Sheets("Summary").Range("A" & _ Sheets("Summary").Rows.count).End(xlUp).Row End If End If -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
!
I wanted to retrieve data from close file.
Thank you! "Dave Peterson" wrote: You mean to retrieve values from cells on a worksheet? You can use helper cells in a worksheet and build formulas to do the work or You could retrieve values from a closed workbook using a routine from John Walkenbach: http://j-walk.com/ss/excel/eee/eee009.txt Look for either: GetDataFromClosedFile or GetValue. Mona wrote: I will be accessing several workbooks (test.xls, test1.xls, ...). What is the syntax to "reference" workbook without having to open it? thanks -Mona Set wbkTarget = Workbooks.open(Filename:="c:\ test.xls") If wbkTarget Is Nothing Then MsgBox "Can not open file" Else Set wksTarget = wbkTarget.Sheets("Summary") If wksTarget Is Nothing Then MsgBox "Could not locate sheet" Else lRow_2006 = Sheets("Summary").Range("A" & _ Sheets("Summary").Rows.count).End(xlUp).Row End If End If -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Is there a template option for Workbooks.Add(xlWBATWorksheet)? | Excel Discussion (Misc queries) | |||
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. | Excel Programming | |||
I want to merge two workbooks but the option is greyed out. Why? | Excel Discussion (Misc queries) | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Workbooks.Open / .Open Text - How do you stop the .xls addition? | Excel Programming |