0

With 3 Word documents opened in separate instances the Documents count will return 1 instead of 3.

Word.Application.Documents.Count

Is it possible to loop through all instances and count/address the documents?

Cor

  • Why do you have multiple Word application instances? How are the 3 word documents being opened into 3 separate instances? – Raymond Wu Oct 23 '21 at 08:55
  • For multiple instances you will likely need to look into Windows API calls to find each instance and check whatever from there. [Windows API Index](https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-api-list) – Samuel Everson Oct 23 '21 at 09:08
  • https://stackoverflow.com/questions/30363748/having-multiple-excel-instances-launched-how-can-i-get-the-application-object-f has what you need for this – Tim Williams Oct 24 '21 at 05:12
  • Thx! I'm going to try to apply that to Word. @Raymond: that's the default behaviour when you select multiple files and press enter. If you open any document after that it will be added to the last opened instance. A big problem with many other forum topics is that the files aren't opened by the VBA script itself but earlier by a user, so I can't list the instance objects in advance. I guess this will work though – Cor Koomen Oct 24 '21 at 09:16

0 Answers0