I have developed a template (Report.dot) that is called from a toolbar (Toolbar1) button. The document this creates has details passed to it by a UserForm. So that the user can switch back and forth between the UserForm and the document, a modified toolbar button appears in place of the first button on the orig toolbar. (The user clicks on ‘Return’ and the UserForm is redisplayed. The new toolbar is Toolbar2).
As all the VBA code is in a global template (AllCode.dot), and I do not want any code in the called template, is there a way to make the toolbar revert from Toolbar2 to Toolbar1 if the user closes their document?
I have tried using ActiveDocument.BuiltInDocumentProperties.wdPropertyCategory = “REPORT” after I ensured that the template Report.dot had that text in its Category property. I realise that I could use an AutoClose module with relevant code in the second template (Report.dot) as closing a document based on a template with an AutoClose module will do what I want, but I need to keep all VBA code in one template only.
Any suggestions will be most welcome as I have just about exhausted my feeble brainpower on this.
Thanks, Leigh