View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hal Hal is offline
external usenet poster
 
Posts: 36
Default Open Workbooks, Used Area on Sheet

I would like to add the capability to the sub below of getting the name of
each worksheet within the open workbooks. I tried nesting a For Each
wsNames(j) within the For Each wb in Application.Workbooks loop. I was not
able to resolve the errors.

Your suggestions are appreciated.


Sub wbsOpen()
' Get the names of all open workbooks and store in an array
Dim wbNames(), wsNames() As String
Dim i, j As Integer, wb As Workbook, ws as Worksheet

ReDim wbNames(1 To Workbooks.Count)

i = 1
For Each wb In Application.Workbooks
wbNames(i) = wb.FullName
Debug.Print wbNames(i)
i = i + 1
Next
End Sub