


Application.CustomizationContext = customizationTemplate Application.Templates(Path.Combine(customizationAddIn.Path, _ "InnerException: " + ex.InnerException.ToString)ĬustomizationTemplate = Me. MessageBox.Show( "Exception while initializing the global template: " + _ ' ErrorCode -2146822615 = "The add-in template is not valid" Path.Combine(userTemplatePath, TEMPLATE_FILENAME))ĬustomizationAddIn = Me.
#ENROUTE 4 MISSING TOOLBARS INSTALL#
' Copy the file from the add-in's install location to the user's Template folderįile.Copy(Path.Combine(addInInstallPath, TEMPLATE_FILENAME), _ ' Template was not found in User's Profile - either this is the first run of Word since installing the Add-in, or the file was deleted accidently ' ErrorCode -2146824128 = "Bad file name", which is the result when the file does not exist (TEMPLATE_FILENAME, True ) ' This variable doesn't refer to the Add-in Assembly, but rather to the Template in the user's Templates profile folderĬatch ex As ' This follows the sample by Cindy Meister ĬustomizationAddIn = Me. ' Get a handle to the Customization Context template if it's not yet in the user's Profile, copy it from the install locationĪddInInstallPath = Path.Combine((), _ "file not found", such as on first use) then I'll have it copy the template from the install location. dot file in the user's Templates folder, and if it throws an exception (e.g.
#ENROUTE 4 MISSING TOOLBARS CODE#
So I figured, "hey this can't be all that hard - it must be done all the time, right? I mean, I've had plenty of apps that seem to copy some settings to my profile/registry the first time I run them." So I changed some of the code in the add-in's Startup event handler, so that it'll try to attach to the. However, for a per-machine install of the add-in (which I would encourage, and which should be the default) it's not only dumb to install anything in the current user's profile, it's difficult (because the key parts of Windows Installer run as LocalSystem) and it's not recommended by Visual Studio 2008 ("Warning: File 'Word2MediaWikiDotNetTemplate.dot' should not be installed into a User's Profile folder because it may not be available to all users.").
