I have a Word project that I've been trying to deploy 2 different ways. First I made the project using VSTO (I'm using Visual Studio 2005) and after following examples and advise, finally got the project to work in the degugger just right. I created the project as a template. To test the release/runtime version, I copied the application/assemply files to the startup folder that Word in pointing to. These include:
BarcodePopper.dll
BarcodePopper.dll.config
BarcodePopper.dot
BarcodePopper.pdb
BarcodePopper.XmlSerializers.dll
When I open Word, nothing happens. I look in the Templates and Add-Ins... dialog and the template is recognized and checked, but upon opening I expected Word to prompt the user with a modal dialog and nothing happened.
I also tried creating an Add-in by following the instructions in http://support.microsoft.com/ kbid=302901. For dubugging, I set the startup program as Word 2003, and when it ran in debug mode, nothing happened. A blank document opened as expected, but the add-in did nothing. No errors. Nothing. I installed it locally to the development machine using the install option in the deployment project created by the add-in wizard. Same thing happened - nothing.
Please help.

Deployment problems
Matthias123
OK, I mostly understand. Firstly, let me be clear that I ended up developing the feature using VBA after my trouble deploying it using VSTO. Also, I still haven't made the time to look over the documents you referred me to and to familiarize myself witht he security aspects of deployment.
Now, regarding the attaching of templates. The statements you quoted are confusing to me; If global templates are not "attached" to any document and don't contribute to the text or styles of the document, then what are they useful for I took those statements to mean that while global templates will not contribute to text or style, that they WILL contribute to the other aspects - such as toolbars, modules, and procedures - the programming. Yet when I put the template in the startup folder containing the working VBA, or manually enabled it in the document it still doesn't work on any of the machines.
Also, as I have stated, the template is implemented as an add-in by attaching it to the document. Yet, because it is launched by and Auto_Open macro function, it will only work after the user proceeds to close and re-open the document. Is there any event I can use that it will launch without them having to re-open the document they attached it to
gabr
Hi Jeff,
Thianks for the references you provided; I will look them over to improve my understanding. Regardless, It would be beneficial for the users if Microsoft would make it clear in the documentation that these documents/solutions will not work as an add-in. I can tell you that it would save time for us - It's crazy to me that so much documentation exists about programming Word and that even though I've read so much about it, I haven't been able to find the right information easily. To be honest, I find the documentation very confusing.
In my opinion, MS should really review their documentation on programming Office and try to consolidate it, including what will work in which versions and clear steps to implement simple solutions. One should not have to spend 2 weeks learning to create such a simple soltution as the one I just release (hopefully, correctly, heh). The exmaples that I found on your site that have been created are overkill for a lot of people and some need to be updated . I'm only running VS 2005, and the 1 or 2 that seemed possibly helpful were in 2003 and had a lot fo parts - too complicated. Though I am sure that they are good examples for broader solutions, they didn't make things easier for me; they certainly do not represent a simple project such as mine; at least, this is a missing type of example that I think if you added to your samples would help the community a lot.
As someone with a fresh perspective on Office Programming, I can tell you that it has not been easy to get anything done with Word Programming. If you want to make it easier for people like me and save us time, I can only tell you that it would have been helpful for me to find an article that explained how to implement a plug-in with buttons, that started/loaded automatically when I opened MS Word 2000 and greater, and that included steps to implement it with existing documents.
A good sample would work like the plug-in for Adobe Acrobat, which is an add-in that is implemented using an installation package. I've used that plug-in a lot and it has always been stable for me. Even though I deployed my solution, I am still wondering why I can't load it on start-up like Adobe does with theirs; I had to attach the template since it would not work when I added it as a global template. I found no where that recommeds I do that, but it is the only way it worked so far.
I am also VERY suprised that one can not write add-ins with VSTO given all of the power of VS 2005 and the available class structure.
******
The best resources I have found so far on this topic have been an article at : http://www.codeproject.com/csharp/wordaddinpart1.asp that includes a reference to MSKB article 302901, which I also found helpful. There is a MS technical article by Frank Rice on MS Templates at http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnword2k2/html/odc_wdtemp.asp that People might find helpful, though I think it could use a review considering that I did not find the information that you posted in this thread and that global templates are not working for me as expected. I needed the document to run my extension as soon as it opens, and so I found the MS technical article by Bill Coan at http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnword2k2/html/odc_wdtemp.asp helpful as well. I hope this helps other people who are struggling like I have to find such information.
******
cjcooper78
Yes, over the past few days I had to experiment and spend the time to discover this the hard way, unfortunately.
Appropriately, the best solution I found to use was writing VBA code into a document template. I can not use VSTO, since I have to apply the extensional functionality to over 30 existing documents.
What is yet unclear is why this template does not work when placed in the startup folder or even if I add it to the templates collection so that it is checked off in the Templates and Add-Ins... dialog; the only way it works is if I Attach the template. Why is this What is the difference between attaching a template and associating a global template
Yogesh Kumar Dhiman
Hi Ryan, we are reviewing our documentation and planning how to improve it. Could you help us by listing the steps you went through to find help for creating your VSTO project If you could list what Web sites you went to (especially the specific URLs), whether you used the product documentation that comes with Visual Studio, and any other sources, it would help us to see how we can improve the experience.
Thanks,
Harry Miller
Technical Editor
http://blogs.msdn.com/harrymiller
This posting is provided "AS IS" with no warranties, and confers no rights.
Phil O MSFT
Admittedly, I haven't pursued this since VSTO 2003. But I think it hasn't changed for 2005...
All Word VSTO projects are document-specific, they can't function as Add-ins. The vSTO code won't load when the template is loaded by Word through the Startup folder. (I think the MSFT person who replied to you missed this detail.)
chjmiller
Thanks for your comments about the documentation. I'll direct those to our doc folks. Microsoft definitely has a lot of different types of "add-ins" and knowing what kind of addin to write for what application can be confusing.
About your Word template solution. If you open the template file from the startup folder (double-click the .dot file), does the template open and run your customization If not, there may be a CAS problem and you will need to set up the proper security policy for that document within that folder. When you created the solution and pressed F5, our project system created the CAS policy for you and it just seems to run. As soon as those files are moved elsewhere on disk, a new CAS policy needs to be created.
Again, I'm not familiar with how this may have worked in VSTO 2003, but if you want a customization solution to run when a document is opened, then that document must have the template attached to it. I'm not aware of any scenarios in which a document can run a template when that template has not been attached. The last article you linked had this to say about global templates:
"Global templates are a type of add-in for Word. Global templates are different from document templates; so different, in fact, that giving both the name "template" can be confusing. They are normally not "attached" to any document and usually do not contribute text or styles to any document."
Therefore, global templates won't be attached to the document and the template customization won't run.
Concerning addins, VSTO 2005 provides the ability to write managed addins for Outlook 2003 (in either VB or C#). My guess is that the Adobe addin you are referring to is an unmanaged COM addin (and not written with VSTO 2005). In our next release that supports Office 2007 we are looking to provide add-in support for all Office applications (not just Outlook as we do in VSTO 2005).
aprilmadams
In addition to the information Cindy provided, take a look at our documentation that describes the limitations to global templates in VSTO (i.e. the assembly code is not called if the template is stored in the Startup directory - you can not have global customizations for Word using VSTO).
http://msdn2.microsoft.com/en-us/library/ms178759(VS.80).aspx
I hope this helps,
Kathleen McGrath
Davor Cokrlic
Hi Ryan.
Can you try a few things so that we can debug this First, are you able to create a simple Word template, add some "Hello World"-type code to it (put a MessageBox.Show("Hello World") in the template's ThisDocument_Startup event) and F5 successfully If so, good. If not, let me know. This needs to work first.
From there, you should be able to navigate to the project output folder and double-click the .dot file. This should also work (and it will work because we create the security required for the assembly to run from this folder when you pressed F5). Once you move that .dot file and assembly to some other location on your local disk, the .dot file will still have permission to run but the assemblies will not.
If you are able to do both of these, have a look at the following topic:
Walkthrough: Deploying a Document and an Assembly to a Local Folder
http://msdn2.microsoft.com/en-us/library/ms404812(VS.80).aspx
I'd take some time and work through that. I think one of the pieces that you are missing is the setting of security on the assemblies (you need to run caspol).
At the bottom of that walkthrough you will also find several other walkthroughs related to deploying solutions on remote servers or via publishing.
Hope this helps.
Allen Noakes
Hi Ryan
I'm not sure if the message below was directed at me, or at Jeff:-) But I get the feeling you were answering me, so...
" Yes, over the past few days I had to experiment and spend the time to discover this the hard way, unfortunately.
Appropriately, the best solution I found to use was writing VBA code into a document template. I can not use VSTO, since I have to apply the extensional functionality to over 30 existing documents.
What is yet unclear is why this template does not work when placed in the startup folder or even if I add it to the templates collection so that it is checked off in the Templates and Add-Ins... dialog; the only way it works is if I Attach the template. Why is this What is the difference between attaching a template and associating a global template"
A global template (or a COM-Addin, whether created with managed code or not) is something that's always available in Word, no matter which document is opened. Word always has at least one global template loaded: Normal.dot. Templates in Word's STARTUP folder are loaded when Word starts; any AutoExec macro in them will be run at this time. "Open" and "New" events/subs will NOT run in a global template. All toolbars and modifications to built-in toolbars should be visible (unless multiple customizations conflict, in this case the last one loaded wins). Global templates can also be loaded "on demand" (Tools/Templates and Addins, the Add button or activating a checkbox for an entry already in the list).
An attached template allows you to provide document- or task-specific functionality. Macros, AutoText, Toolbars and keyboard assignments in it are only available to the documents to which it is attached. Often, such a template will contain styles and structures (a letterhead, for example) which documents created from it will inherit.
a link to general information on the topic:
http://word.mvps.org/faqs/customization/WhatTemplatesStore.htm
You might want to Google the word.vba.general newsgroup (NNTP) on microsoft.com or search its web interface
http://www.microsoft.com/office/community/en-us/default.mspx dg=microsoft.public.word.vba.general&lang=en&cr=US
as this topic does come up regularly. There are a lot of knowledgeable folks there, with a wide range of experience in providing template-based functionality.
dereck27
Yes, VSTO 2005 Word projects are either documents or templates (and activated when the document or template is opened). VSTO 2005 does not provide support for application-level addins for Word.
Unfortunately, I'm not familiar with how VSTO 2003 worked in this regard.