Running a macro from a password protected Word template

D

DaveMSDN123

Hi, can you please tell me how to supply a password to the
Microsoft.Office.Interop.Word.ApplicationClass.AddIns.Add() method in order
to bypass the password dialog? I have to add-in the template that contains a
macro so I can run it against my current document.

I know that I can supply a password to the
Microsoft.Office.Interop.Word.ApplicationClass.Documents.Open() method to
open the template, but then when I open the document, then try to run the
template's macro against the current document, it throws "unable to run the
specified macro", probably because the template is no longer the current
document. However, when using AddIns.Add() to load the template, then I open
the document, I'm able to run the template's macro against the current
document successfully. The only problem is that I can't supply a password to
the AddIns.Add() method, so the password dialog pops up, and that is not
acceptable.

Thanks,

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top