using array with Windows().activate

N

NikkoW

If it isn't one thing its another. This generates type mismatch error on the
last line. Am I doing something stupid again or, if I can't do it this way,
can someone suggest a better way? Thanks!

Sub ImaNoob()
Dim MyFiles, I As Variant
MyFiles = Array("Con.xls", "CAN1a.xls", _
"CAN1b.xls", "CAN1c.xls")
For Each I In MyFiles
Application.Windows(MyFiles(I)).Activate
....do some stuff
Next I
End Sub
 
T

Tom Ogilvy

Sub ImaNoob()
Dim MyFiles, I As Variant
MyFiles = Array("Con.xls", "CAN1a.xls", _
"CAN1b.xls", "CAN1c.xls")
For Each I In MyFiles
Application.Windows(I).Activate
....do some stuff
Next I
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top