How to check if ANY excel workbook is open?

后端 未结 3 2058
刺人心
刺人心 2021-01-24 19:11

I have a VBA project in excel which hides the workbook in the background and only shows the userform, it works fine however, causes problems when other workbooks are open as it

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-24 19:13

    This may help you:

    Public Sub openWorkbooks()
        Dim wb As Excel.Workbook
        For Each wb In Excel.Workbooks
            ' Do whatever you need to do here
            ' This prints the workbook name to the inmediate window
            Debug.Print wb.Name
        Next wb
    End Sub
    

提交回复
热议问题