How To install a Word Template Add-In for all users?

Hello! I'm developing an application which needs a Word integration.

I've managed to create a Word Template Add-in (.dot file). Now I have to place it in word startup folder upon installation of our product.

I've managed to determine the location of word startup folder for current user (through StartupPath property of Word.Appliction Com object).

But I have to install a word integration for ALL USERS on this PC.

How can I identify word startup folders for other users? Maybe through registry by enumerating HKEY_USERS key? Maybe this can be foudn through Word Com object too?

 

Question Info


Last updated September 3, 2019 Views 3,020 Applies to:

Version of Word?

Operating System?

Is there a reason you are using a .dot file rather than a .dotm or .dotx format?

Please mark helpful or answered as appropriate to help other users.

Charles Kenyon
Attorney at Law
Madison, Wisconsin
wordfaq[at]addbalance[dot]com

http://addbalance.com/usersguide/styles.htm

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

The prog should work in Windows 7-10, Word 2003-2016. That's why I chose .dot. If you can suggest an easy way of install (including switching to .dotx or .dotm), I could narrow it to 2007-2016.

Also I can consider using .wll. Will it change a way of installing?

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hello, anyone?

Just give me any clue, I'm sure I'm not the first person who faces this problem!

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

I think that you are going to need to log onto the computer in the name of each user.  Having done that however you could install the add-in in

%APPDATA%\Microsoft\Word\Startup

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
Screen shots by Snagit from www.techsmith.com

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Nope, That is an incorrect answer.

1. The user could change startup folder so any fixed location won't go.

2. Could you please specify how installation program can login as any user without knowing a password?

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

It is the unusual user who changes the startup path. The following vba construct will show it;

application.StartupPath

It is in the registry for the current version of Word as STARTUP-PATH.

computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Word\Options

I do not know how you get to that without logging in, though.

How about emailing your Add-In with instructions?

I have several Add-Ins that install themselves with a user click on a macrobutton field in the file. The following code should do this. You would need a macrobutton field in your template calling it. This will work with either the template open or in a document based on the template.

Sub InstallAddIn()

' Saves the template containing code in user's startup folder

' User must allow running of macro

' written by Charles Kenyon December 5, 2016

    Dim strStartup As String
    strStartup = Application.StartupPath
    ThisDocument.SaveAs2 (strStartup & "\" & ThisDocument.Name)
End Sub

Please mark helpful or answered as appropriate to help other users.

Charles Kenyon
Attorney at Law
Madison, Wisconsin
wordfaq[at]addbalance[dot]com

http://addbalance.com/usersguide/styles.htm

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

1. Thank you for your tip with Application COM object. Please read my original post why it does not help;

2. I've got MS OFFICE 2007 installed, and I have NO Startup Path entry in

HKCU\SOFTWARE\Microsoft\Office\12.0\Word\Options

Looks like its presence is optional;

3. I can easily get registry for other users by enumerating HKEY_USERS key, but that wouldn't help, see p.2 of my answer;

4. Yes, I've also thought about adding special "Install MS Word add-in" command to my application, but that would go only as the last option, if there will be no other way.

EDIT: Yes! STARTUP-PATH entry shows up after I've changed the default location.

So my actions will be the following:

- Enumerate existing users in HKEY_USERS registry key.

- See if .. word\options\STARTUP-PATH exists. If yes, copy file there

- If no, get %appdata% contents from ..\Microsoft\windows\current version\Exlporer\shell folders and add Word\Startup.

Whoa, Looks like we've done it!

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Actually I was a bit wrong. Not All users' registries are loaded to HKEY_USERS. 

To Load it, you should enumerate user profiles in profiles folder, find NTUSER.DAT in it and load it with RegLoadKey function.

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.