Connecting an Add-In to Word 2007 with command line arguments.

R

Ramon Gene

Hello:

I have a Microsoft Word Add-In, which is developed in managed code,
exposed as COM and registered with Word 2007. I can connect my AddIn to
Microsoft Word with no issues by going to Word Options/Add-Ins/COM Add-Ins
and selecting it from the list.

How can I connect my Add-In to Microsoft Word when using command line
arguments?

I noticed the “/l†switch here:
http://office.microsoft.com/en-us/word/HP101640101033.aspx#4
however it is not working for my Add-In. One thing that I noticed is that
my Add-In shows mscoree.dll as the location under the COM Add-Ins list in
Microsoft Word.

Thanks a lot,
Ramon
 
J

Jialiang Ge [MSFT]

Hello Ramon,

This a quick note to let you know that I am performing research on this
issue and will get back to you as soon as possible. Based on my test, it
pops up a warning box "the add-in template is not valid" when I try to load
the managed com add-in with word startup switch "/l". Did you encounter the
same warning message on your side?

In addition, I'd like to share some background information about
mscoree.dll and managed com add-in.
Managed COM Add-ins are managed classes that are com-visible and
registered. Normally, a com addin has a registry key under the Word addins
key that specifies the ProgId implementing the addin. The corresponding
ProgId key defines the ClassID (guid). The ClassID key defines the In-proc
server for the addin. Since this is a managed addin, the in-proc server is
the CLR runtime (mscoree.dll). Word load the runtime, which instantiates
the add-in; the fact that the addin is managed is transparent to Word.
The following article explains the managed and unmanaged com addin loading
process in detail.
http://blogs.msdn.com/msdnts/archive/2006/12/28/how-to-troubleshoot-the-com-
add-ins-loading-issues.aspx

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Ramon Gene

Hello Jialiang:

Thank you for your response.

What I get when I run winword /lâ€c:\path to my addin.dll†is a file
conversion dialog in Word asking for the encoding of the document, then if I
click Ok I get “The add-in template is not validâ€, if I click Cancel I get
“Word cannot open this document templateâ€,

Thanks!
Ramon
 
J

Jialiang Ge [MSFT]

Hello Ramon,

Thank you for your patience. I also saw the conversion dialog for encoding
when I did the test. When I click OK, the warning "The add-in template is
not valid" is popped up.

In fact, based on my best, the same conversion dialog and the warning
message are also popped up if it is an UNMANAGED COM add-in, let alone the
managed ones. I discussed the issue with Word product team, and according
to their response, the startup switch "/l" is designed for a WLL(a dll
using the Word C API) and not for COM Addin DLL. COM Addins use a different
methodology to load. See:

183758 How To Build a Microsoft Word Add-in (WLL) Using Visual C++
http://support.microsoft.com/default.aspx?scid=kb;EN-US;183758

190057 HOWTO: Use Microsoft Word's CAPI Messaging Interface (CMI)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;190057

I am still researching to see if there is any other method to load the
"load on demand" COM addins when Word starts up.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jialiang Ge [MSFT]

Hello Ramon,

Thank you for your patience again. I have to let you know that this is a
"by design" behavior that we cannot load a "load on demand" COM addin when
Word starts up without changing the registry key "LoadBehavior" of the
addin from 8 (load on demand) to 3. This is what "load on demand" means
for. I have spent a lot of time researching if there is a possible
workaround. I have tried a macro to load COM addins, but fails because in
Word object model, Application.AddIns.Add is also not designed for COM
addins.

Would you let me know if this issue is very critical to your current
business? If that, I'd suggest contact Microsoft Product Support. They will
decide if it is necessary to ask the product team to add the feature as a
hotfix or add it into next release of Office system., by contacting us at
1-(800)936-5800 or by choosing one of the options listed at
http://support.microsoft.com/common/international.aspx?rdpath=fh;en-us;cntac
tms.

If you have any other concerns or need anything else, please do let me know.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
R

Ramon Gene

Hello Jialiang:

Thank you so much for your help on this issue and for your efforts on
finding a solution for me.

Fortunately, the issue is not very critical to our business. We are
currently connecting the Add-In from an exe console application, using the
Word object model to create a new instance of the Word application and
connecting the Add-In thru addIn.Connect=True. We wanted to switch to using
Process.Start("winword.exe") passing a parameter to connect the Add-In to
solve another issue that we are seeing when using the Word object model
approach, but it is not a breaking issue for our application.

Thanks again,
Ramon
 
J

Jialiang Ge [MSFT]

Thank you, Ramon, for your understanding of the product limit unexpectedly
caused by a "by design" feature in Office.

When you encounter any other problem, please do let me know. I will spare
no effort to help you. If it turns out to be an issue caused by our product
limit or a behavior by design (like this one), it's my pleasure to help
send a wish to our product designers via internal channel, or discuss with
you other support options where the development team may consider building
hotfixes or changing product designs for you.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 

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