Thread: Workbooks Array
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Workbooks Array

Don't think that approach will work, but you could try

For Each wb OtherIn Workbooks

If Not IsError(Application.Match(wb.Name, (Array("One.xls",
"Two.xls", "Three.xks")), 0)) Then

MsgBox wbOther.Name
End If
Next wb


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
I want to work with a group of workbooks, one at a time. I wanted to use
the following statement but I get a "Type Mismatch" error on the "For
Each..." line. All the workbooks are open.
My code, simplified, is:
Dim wbOther as Workbook
For Each wbOther In Workbooks(Array("One.xls", "Two.xls", "Three.xls"))
MsgBox wbOther.Name
Next wbOther
How can I setup a "For" loop for a group of workbooks?
Thanks for your time. Otto