View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Eric White[_2_] Eric White[_2_] is offline
external usenet poster
 
Posts: 45
Default Check if several workbooks are open

On the fly:

Dim WorkbookNames() as Variant
Dim wb as Workbook
Dim i as Integer

WorkbookNames = array("Workbook1.xls", "Workbook2.xls", "Worbook3.xls")

For i = 0 to Ubound(WorkbookNames)
On Error Resume Next
Set wb = Workbooks(WorkbookNames(i))
If wb Is Nothing Then
Workbooks.Open WorkbookNames(i)
End If
Next i
On Error Goto 0

Set wb = Nothing



"Ricardo Silva" wrote:

Hi,
I want to check if a list of workbooks are open and if not open them.
Could someone help me?