0

I'm trying to run a Microsoft Word process without addins but don't have permissions to stop them, so I want to launch Microsoft Word in safe mode or with /a and connect to it rather than create a new instance. is this possible? any tips on what code I need to attach to a running instance?

Normally:-

_Application objWord;
if (!objWord.CreateDispatch("Word.Application"))
{

    return 0;
}

// ok
Deduplicator
  • 43,322
  • 6
  • 62
  • 109
user3725395
  • 143
  • 1
  • 10

1 Answers1

1

Using CreateProcess and passing /a as a command line argument you are able to start Word in Safe Mode. You can then connect to the running instance and obtain an Application object by calling the AccessibleObjectFromWindow function.

You can have a look at my answer to another question which contains an example written in C#:

How to access Microsoft Word existing instance using late binding

Community
  • 1
  • 1
Dirk Vollmar
  • 167,121
  • 53
  • 251
  • 309