AndrewPerl
11-29-2005, 03:33 PM
I wrote the following macro to set some options and then load an addin and a custom dictionary. The problem is that during testing the addin is loaded more than once. This also causes the toolbar which is part of the addin (just a template) to load repeatedly. Is there some way I can check to see if the Addin is already loaded so I can skip this part of the code.
Private Sub Document_Open()
'Set path variable for template location
Const WGTemplatePath = "W:\Office Templates"
'Set path variable for dictionaries
Const WGDictPath = "W:\office Templates\Template Resources\Dictionaries\"
'Set variable for name of TA2000 dictionary
Const TADICTName = "TA2000 Dictionary.dic" 'name of custom TA2000 dictionary
'Set variable for writing style (options are "GRAMMAR" and "GRAMMAR & STYLE")
Const WriteStyle = "Grammar & Style"
'Set variable to complete building pathname for SES_Macros.dot addin.
Const SESMacrosPath = "\Project Documentation\SES_Macros.dot"
'Set the workgroup templates path to W:\CORPCOMM\CMS Template Files
MsgBox "Click OK to set the Workgroup Template path. This may take a few seconds."
Options.DefaultFilePath(wdWorkgroupTemplatesPath) = WGTemplatePath
'Set various Word environment variables
Options.AllowFastSave = False 'Turn off Fast Saves;reduces chances of file corruption
Options.Overtype = False 'Turn off Overtype mode;just plain annoying
Options.PromptUpdateStyle = False 'Do not allow users to update styles;just reapply current style to selection
Options.SaveInterval = 10 'Save current document every ten minutes
Options.UpdateFieldsAtPrint = False 'Do not updates fields when printing
Options.UseCharacterUnit = False 'Do not use character unit;use inches instead
'Set the writing style to check grammar and style
Languages(wdEnglishUS).DefaultWritingStyle = WriteStyle
'Install the TA2000 dictionary
CustomDictionaries.Add FileName:=WGDictPath & TADICTName
'Install the SES_Macros template as an AddIn and ensure it is installed
AddIns.Add FileName:=WGTemplatePath & SESMacrosPath, Install:=True
End Sub
Any help on this would be greatly appreciated.
Thanks,
Andrew in Kansas City
Private Sub Document_Open()
'Set path variable for template location
Const WGTemplatePath = "W:\Office Templates"
'Set path variable for dictionaries
Const WGDictPath = "W:\office Templates\Template Resources\Dictionaries\"
'Set variable for name of TA2000 dictionary
Const TADICTName = "TA2000 Dictionary.dic" 'name of custom TA2000 dictionary
'Set variable for writing style (options are "GRAMMAR" and "GRAMMAR & STYLE")
Const WriteStyle = "Grammar & Style"
'Set variable to complete building pathname for SES_Macros.dot addin.
Const SESMacrosPath = "\Project Documentation\SES_Macros.dot"
'Set the workgroup templates path to W:\CORPCOMM\CMS Template Files
MsgBox "Click OK to set the Workgroup Template path. This may take a few seconds."
Options.DefaultFilePath(wdWorkgroupTemplatesPath) = WGTemplatePath
'Set various Word environment variables
Options.AllowFastSave = False 'Turn off Fast Saves;reduces chances of file corruption
Options.Overtype = False 'Turn off Overtype mode;just plain annoying
Options.PromptUpdateStyle = False 'Do not allow users to update styles;just reapply current style to selection
Options.SaveInterval = 10 'Save current document every ten minutes
Options.UpdateFieldsAtPrint = False 'Do not updates fields when printing
Options.UseCharacterUnit = False 'Do not use character unit;use inches instead
'Set the writing style to check grammar and style
Languages(wdEnglishUS).DefaultWritingStyle = WriteStyle
'Install the TA2000 dictionary
CustomDictionaries.Add FileName:=WGDictPath & TADICTName
'Install the SES_Macros template as an AddIn and ensure it is installed
AddIns.Add FileName:=WGTemplatePath & SESMacrosPath, Install:=True
End Sub
Any help on this would be greatly appreciated.
Thanks,
Andrew in Kansas City