Thread: [Solved] Word.Application Object
View Single Post
 
Old 11-10-2016, 04:17 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Your code is doing as you expect but you are not making use of the loaded addin before quitting Word. If Word is subsequently re-opened, you will discover the addin is now in your list of addins but its status is not turned on.

You can either choose to turn this on every time you open Word by using just your .Installed line but if you want it ALWAYS turned on, it is easier to simply copy the template to the Addins folder.

By default the Addins folder is in %appdata%\Microsoft\Addins OR %appdata%\Microsoft\Word\STARTUP but it could have been changed by the user so this following code would perform the task of installing the template in a location so that whenever Word is opened, the addin is installed and active.

Code:
Set oWord = CreateObject("Word.Application")
  Dim sAddins As String
  sAddins = oWord.Options.DefaultFilePath(8) 'where 8 = wdStartupPath
  FileCopy "C:\Program Files (x86)\Labelling Tool v.2.0\LabelingData\Labeling.dotm"", sAddins & "\Labeling.dotm"
  oWord.Quit
Set oWord = Nothing
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote