View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mona Mona is offline
external usenet poster
 
Posts: 69
Default 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