It’s been a while since I have had to write VBA, but I’m really struggling with this one. My client requires custom styles to be added to the Normal.dot so that every document created will contain these styles. Originally I created a Normal.dot with all the customization and was going to distribute to this specific set of users (legal dept in big o&g co); however, their IT department has disapproved of a customized normal.dot – due to the fact that they use a Document Mgmnt system that inflates the normal.dot and it needs to be deleted on a regular basis.
So, I thought I would put all the customization into a User.dot file and put it in the start-up folder – that way any toolbars/macros that I have customized will be available to the user. The problem is making the styles (with keybindings) and autotext available. My current thought is to create a macro with a toolbar button that will copy these commands to the Normal.dot and, if the normal.dot is deleted due to inflation/corruption, it will be easy to train staff to click on a button to add these items back to the normal.dot so they exist for each new document being created. I have researched/tested the Application.OrganizerCopy for both Styles and AutoText but I receive a run-time error 4149. Also, it appears as though I have to create a separate entry for each style/autotex item – I would prefer for this to not to be hard-coded so that the macro doesn’t need updating if new styles/autotext are added to the user.dot in the future. Also, will the code accept %username% instead of an ‘actual’ username? I have used the same code to copy the two autotext entries and added all the keybindings via code.
[codebox] Application.OrganizerCopy Source:= _
“C:Documents and SettingsTrishApplication DataMicrosoftWordSTARTUPTLMUser.dot” _
, Destination:= _
“C:Documents and SettingsTrishApplication DataMicrosoftTemplatesNormal.dot” _
, Name:=”Normal”, Object:=wdOrganizerObjectStyles
[/codebox]
I have fiddled with the following code for copying the styles (with keybindings) to the ActiveDocument; however, this code is creating a second occurence of the User.dot toolbar (I’m assumming one is stored in the active document as well as the add-in)??? Not sure why the toolbar is being copied?? I’m unsure of how to perform this by copying to the NormalTemplate… ?
[codebox] With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = “TLMUser.dot”
End With
With ActiveDocument
.UpdateStylesOnOpen = False
.AttachedTemplate = “TLMUser.dot”
End With
[/codebox]
I would greatly appreciate any suggestions any of you may have in this regard. Thanx… trish