Sys.OleObject. Microsoft Office (Word, Excel)
I want to get the properties and methods of an already running Microsoft Office (Word, Excel) application.
For this I use OLE object but I get an error "This command is not available because no document is open."
I take into account what is written in the documentation:
Note for Microsoft Office users: In order to be able to get an OLE object for an already running application, this application must be registered in the Running Object Table (ROT). However, Microsoft Office applications that are launched from the shell (for example, from the Start menu or the TestedApps project item) do not register their running objects at startup, but rather once the application loses focus. So, if you obtain an OLE object for an already running Office application, you may get errors when accessing its properties and methods (for more information on this problem, see http://support.microsoft.com/kb/238610/).
To work around the problem, you can activate any window other than the tested Office application before attaching to its OLE server. This will allow the Office application to register itself in the ROT, so you will be able to work with it via OLE. In scripts, you can activate a window using the Activate or Click action. For example, use the following statement to activate the Windows taskbar
This worked in TestComplete9 but doesn't work now (TestComplete15). Maybe there is some solution for this case? I use DelphiScript