none
How do I add an add-in in Word 2007/2010 via registry or vbscript? RRS feed

  • Question

  • Hi! I've got this add-in I created in Word 2007 that has been saved as a dotm file. I know I can add this as an add-in manually. But I'm interested in deploying this add-in to a whole bunch of computers. And I'm not sure where to start. I've done this previously with a PowerPoint addin. And in that case I added a few lines in the registry.

    [code]
    [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\PowerPoint\AddIns\AutoOpen]
    "Path"="C:\\apps\\templates\\AutoOpen.ppam"
    "AutoLoad"=dword:00000001
    [/code]

    But this does not seem to work with Word. I tried the exact same thing but no dice. Does anyone have any information on this?

    Monday, August 1, 2011 8:40 AM

Answers

  • Hi Kenny

    The Office applications aren't the same. PowerPoint does it one way, Excel another, and Word is quite different from both of those. The Office applications were developed quite independently of one another, back in the late eighties/early nineties. Word and Excel are much more user-oriented in their basic approaches than PowerPoint because they always had a macro language (prior to VBA).

    I think you misunderstood what I told you originally...

    <<The only way I can do this now is to add the dotm-file to the STARTUP folder? A horrible workaround could be to deploy a file to the startup folder, have some macro code in there that adds the dotm file as an add-in. And when that's done, write to a log file that "addin was installed" and then delete the same file in the Startup folder using a vbscript at next logon IF the log file exists.. Seems rather tedious to be honest>>

    If you put the file in the Startup folder you don't need to do anything else. It's there and will be loaded as an add-in. You don't need a macro in addition.

    if you want a macro to load the file, then you certainly don't want to put it in the Startup folder. In that case, it could be anywhere you like. And please note that that macro has to run EVERY TIME Word starts.

    Or, you forget the "template framework" approach and create a IDTExtensibility2 Add-in which DOES work on the Registry principle, across the board, for all Office apps.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Kenny Bones Tuesday, August 2, 2011 10:53 AM
    Monday, August 1, 2011 12:59 PM
    Moderator

All replies

  • Hi Kenny

    for Word, if you put the template into the STARTUP folder Word will load it automatically. The default path for this folder is in the user's profile under ...\Microsoft\Word, but this can be changed by the user or the network admin. If it is, the alternate location is available from the Registry in the HKCU.


    Cindy Meister, VSTO/Word MVP
    Monday, August 1, 2011 9:39 AM
    Moderator
  • Would that be the same as adding it as an add-in? Isn't it possible to add an add-in programatically? The same was as I do when I manually add it via Word-Addins in Word Options?
    Monday, August 1, 2011 11:04 AM
  • Hi Kenny

    There's no way, programmatically, to tell Word "this file over there is an add-in, load it" at time of installation.

    If you're otherwise running code in Word, then it can emulate the user activating a checkbox in the "Templates" dialog. But nothing else...


    Cindy Meister, VSTO/Word MVP
    Monday, August 1, 2011 12:25 PM
    Moderator
  • Then why and how is it possible with PowerPoint? The same registry entries are there in the Word section in the registry too.

    Also, if I created this add-in using Visual Studio then it would be possible then? The only way I can do this now is to add the dotm-file to the STARTUP folder? A horrible workaround could be to deploy a file to the startup folder, have some macro code in there that adds the dotm file as an add-in. And when that's done, write to a log file that "addin was installed" and then delete the same file in the Startup folder using a vbscript at next logon IF the log file exists.. Seems rather tedious to be honest. I find it strange that Word, PowerPoint and Excel are so different. Creating a full Office template framework is huge work.

    Monday, August 1, 2011 12:38 PM
  • Hi Kenny

    The Office applications aren't the same. PowerPoint does it one way, Excel another, and Word is quite different from both of those. The Office applications were developed quite independently of one another, back in the late eighties/early nineties. Word and Excel are much more user-oriented in their basic approaches than PowerPoint because they always had a macro language (prior to VBA).

    I think you misunderstood what I told you originally...

    <<The only way I can do this now is to add the dotm-file to the STARTUP folder? A horrible workaround could be to deploy a file to the startup folder, have some macro code in there that adds the dotm file as an add-in. And when that's done, write to a log file that "addin was installed" and then delete the same file in the Startup folder using a vbscript at next logon IF the log file exists.. Seems rather tedious to be honest>>

    If you put the file in the Startup folder you don't need to do anything else. It's there and will be loaded as an add-in. You don't need a macro in addition.

    if you want a macro to load the file, then you certainly don't want to put it in the Startup folder. In that case, it could be anywhere you like. And please note that that macro has to run EVERY TIME Word starts.

    Or, you forget the "template framework" approach and create a IDTExtensibility2 Add-in which DOES work on the Registry principle, across the board, for all Office apps.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Kenny Bones Tuesday, August 2, 2011 10:53 AM
    Monday, August 1, 2011 12:59 PM
    Moderator
  • Aha I see. I did know that Office applications have a lot of differences. I've done quite a few macros for both Word, Excel and Powerpoint and I've seen how they differ. Just didn't think add-ins were different as well. So, the main thing for me is that I want my template framework to be clean and simple. So is it possible to move the path of the STARTUP-folder? Would that effect all Office applications? I've got a potential add-in for Word, Excel and PowerPoint as well.

    And these should all autostart with the application itself, because I need to run a few checks to see which template it is etc. What would be the best approach for this?

    Tuesday, August 2, 2011 6:40 AM
  • The dotm- file contains a custom Ribbon tab with a few buttons. But every time Word starts, a macro should be fired that basically sets the Default Theme to my own custom theme. I do know how to do this via macro code and probably using the Document_New handler.

    But, I'm trying to change the STARTUP folder to my own custom folder. So is it even possible to change the STARTUP folder via GPO? I can see that the settings are there, but they don't do anything..

    I'm adjusting this setting: Microsoft Office Word 2007/Word Options/Advanced/File Locations/Startup and it doesn't work. I can't even find the setting in the registry either. Any light on this?

    Edit: Creating a new thread for that
    Tuesday, August 2, 2011 10:53 AM
  • Hi Kenny

    In the meantime, I've moved your question about group policies to the forum that deals more with that kind of thing (TechNet).

    <<Just didn't think add-ins were different as well.>>

    Only template-based add-ins. The COM Add-ins (IDTExtensibility2 interface) are handled the same way, and via Registry entries.

    <<is it possible to move the path of the STARTUP-folder? Would that effect all Office applications?>>

    Since the Startup folder in question is Word's very own, no other Office application will be affected. What could be affected are any templates users have put in a Startup folder. Those won't move if you change the Startup folder location and you could get complaints about "why aren't my tools loading".

    Word's startup folder can be set through the UI, in the Options/Advanced section. It's a button named "File locations". It can also be set via the Word object model. A Group Policy is the better choice if we're talking about installing something for an entire "workgroup" in a company setting. But you shouldn't go changing it without clearing it with IT Admin first.


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 2, 2011 1:25 PM
    Moderator