0

When I use the following code to display all open workbooks, its only displaying one name(the current workbook's name). Anyone know why this happen?

sub showOpenwbs
for each OpenWB in workbooks
msgbox OpenWB.name
next OpenWB
end sub
anandhu
  • 686
  • 2
  • 13
  • 40
  • 2
    If a workbook is open in a second instance of Excel then you won't see it from another instance. – Tim Williams May 02 '19 at 17:59
  • Hi, How do I know if its in second instance? Also how can i prevent worksheets from opening in different instances? – anandhu May 02 '19 at 18:09
  • 2
    Please look at all the solution in https://stackoverflow.com/questions/30363748/having-multiple-excel-instances-launched-how-can-i-get-the-application-object-f . One solution lists all instances, and another points to listing all workbooks inside all instances. At least all books can be known. As for "prevent" opening that is another question that might warrant another "googling". – donPablo May 02 '19 at 18:21
  • In Task Manager >> Processes tab, there would be >1 listing for Excel. I'm not sure how you'd prevent this from occuring. – Tim Williams May 02 '19 at 18:21

0 Answers0