open workbook count is 1(!) RRS feed

  • Question

  • hey everyone,

    I am trying to show the names of all workbooks open

    when i debug i can see in the locals wondow that Intcounter equals 1 and that's why i get only the name of the active workbook

    here is my code:

    Sub ShowBookNames()
    Dim IntCounter As Integer
    IntCounter = Application.Workbooks.Count
    For i = 1 To IntCounter
       MsgBox ("You have a open workbook named " & Application.Workbooks(i).Name)
    End Sub


    Thursday, September 27, 2012 3:30 PM

All replies

  • If intCounter is 1, you apparently have only one workbook open in this instance of Excel. If you expected more, perhaps you have multiple instances of Excel running simultaneously?

    Regards, Hans Vogelaar

    Thursday, September 27, 2012 4:12 PM
  • some how it worked out

    thank you

    Thursday, September 27, 2012 4:47 PM