Running as admin breaks COM interaction

Get help with using AutoHotkey and its commands and hotkeys
ardent246
Posts: 7
Joined: 22 Nov 2019, 16:35

Running as admin breaks COM interaction

07 Dec 2019, 08:45

Anyone know why running a script as admin prevents my comobject from working?

The following code works perfect if I run the script not as admin:

Code: Select all

F2::
oWord := ComObjActive("Word.Application")
oWord.Selection.PageSetup.LineNumbering.Active := 1
oWord := ""
return
If I run the script as an admin either by right clicking the AHK file or by putting the code below into my script the code above does not work anymore.

Code: Select all

If not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}
Thanks!
User avatar
boiler
Posts: 3334
Joined: 21 Dec 2014, 02:44

Re: Running as admin breaks COM interaction

07 Dec 2019, 08:57

It should work if Word is also run as admin.

Return to “Ask For Help”

Who is online

Users browsing this forum: georgedx and 218 guests