I have a VB6 app that automates different Office applications. I need to be able to create different instances of these apps at various times, some "hidden" in order to interrogate various metadata, for example, version of the Office app installed on client machine, among other things.
I noticed that invoking the PPT VBA "Quit" method does not close just the PPT instance associated with the application object that it is invoked for, it also closes all other PPT instances that are open at the time the method is invoked. This is unlike other Office apps, like Word, which terminate only the associated instance.
I am attaching some sample code. Please note that I create the Office objects late-bound because different users will have different versions of Office installed (hence the interrogation of version mentioned above).
Create a new form and place the following code in the Form_Load() event:
Start PowerPoint manually (e.g. not through VB automation), then run the above code. You will see that the automated instance opens and closes, AND the instance started manually closes as well. CreateObject should be getting a unique handle to a unique instance of PPT.