Prevent a COM add-in from stealing the save event

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Prevent a COM add-in from stealing the save event

Post by ErikJan »

In WORD2007, we have a COM Add-in loaded that adds classification to documents. For a tool I'm creating, I'd like to be able to prevent this from happening while my code is running. I cannot unload the add-in (admin rights required) nor change its code. I tried to program a "before save" event myself but the existing add-in seems to be getting preference and kicks in before my code does. Suggestions?

User avatar
HansV
Administrator
Posts: 78532
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by HansV »

Where is your tool located? In the active document, in the template attached to the active document, in another add-in or in Normal.dotm?
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by ErikJan »

Actually the tool runs from Excel, from there I create a file, control WORD to open the file, do some stuff and save the file back out, then close Word. The classification COM-addin interferes with automation as it's popping up when Word saves the file. I don't want that.

User avatar
HansV
Administrator
Posts: 78532
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by HansV »

I don't know how to get around this problem. Does the COM add-in have any "hooks" to modify its behavior?
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by ErikJan »

Nope, it's not mine (and protected)

User avatar
HansV
Administrator
Posts: 78532
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by HansV »

I know it's flaky, but you could try using SendKeys to close the add-in's dialog.
Best wishes,
Hans

Becks
2StarLounger
Posts: 196
Joined: 31 Mar 2011, 03:41
Location: Perth, Western Australia

Re: Prevent a COM add-in from stealing the save event

Post by Becks »

Are you able to open a WORD session that prevents add-ins being loaded?

Regards
Kevin

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by ErikJan »

Becks wrote:Are you able to open a WORD session that prevents add-ins being loaded?

Regards
Kevin
No, that's the approach I've been focusing on also. I do not seem to be able to start WORD from VBA with a command line argument like "/a" (even if that would prevent COM addins from loading).

Alternatively, I tried various approaches to unload the add-ins after WORD has started, that works but then a dialog box pops up requiring user-interfacing as admin rights are required for the specific COM add-in to be unloaded...

User avatar
Jan Karel Pieterse
Microsoft MVP
Posts: 656
Joined: 24 Jan 2010, 17:51
Status: Microsoft MVP
Location: Weert, The Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by Jan Karel Pieterse »

I'd contact the author of the COM add-in and ask them for a way to (temporarily) disable it.
Regards,

Jan Karel Pieterse
Excel MVP jkp-ads.com

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Prevent a COM add-in from stealing the save event

Post by Don Wells »

Just a wild hope, but do you need admin rights to move the .com file?
Regards
Don

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by ErikJan »

Jan Karel Pieterse wrote:I'd contact the author of the COM add-in and ask them for a way to (temporarily) disable it.
I'm going to but I need this to work for me on 0.1% of the systems so I doubt if changes will be made (if I could find the author in the first place) ...

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by ErikJan »

Don Wells wrote:Just a wild hope, but do you need admin rights to move the .com file?
I had thought about that too. Problem is that after my tool runs, all should be back to normal, if I move the addin (IF I could), I'd have to move it back afterwards. What if there's an error in my tool one day...

User avatar
Jan Karel Pieterse
Microsoft MVP
Posts: 656
Joined: 24 Jan 2010, 17:51
Status: Microsoft MVP
Location: Weert, The Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by Jan Karel Pieterse »

Well, perhaps there already is a way to do that programmatically, they just need to tell you how?
Regards,

Jan Karel Pieterse
Excel MVP jkp-ads.com

User avatar
ErikJan
BronzeLounger
Posts: 1254
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Prevent a COM add-in from stealing the save event

Post by ErikJan »

Jan Karel Pieterse wrote:Well, perhaps there already is a way to do that programmatically, they just need to tell you how?
Actually when I approached them, it appeared that they've been thinking about this too and now have this functionality already in Beta... Looks like my problem is going to solve itself afterall...

Thanks for all the help and suggestions to all, it was usefull and if I can't get it afterall, I'll revive the search for the fundamental problem (stopping the Com adding somehow) here.