Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2022, 02:55 PM
Charles Kenyon Charles Kenyon is offline Removing CustomUI when saving word file from template Windows 11 Removing CustomUI when saving word file from template Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,533
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default


Quote:
Originally Posted by Cosmo View Post
***

Perhaps I misunderstood what you meant by 'global template'. I was reading that as a separate template file with the UI and VBA code, and a separate template file with the content with no UI and VBA code. Currently, the template file has the content and the UI and VBA.
This is what I mean.
A global template that contains the UI modifications and any related code, separate from the document template that contains the content and document format/styles.
The global could also hold building blocks that can be used to create content.
I am assuming that your UI modification is done by editing the XML of the template, not through vba on-the-fly editing. (Customize the Office Ribbon (It doesn't take rocket science) by Greg Maxey )

A global template in the Startup folder shares the UI modifications with all other documents / templates but does not insert those mods in others. They can be used.
If this is only to work with certain document templates, those templates could load the Add-In upon creation of a document and then the document template's code could unload the Add-In when the new document is closed.
Reply With Quote
  #2  
Old 09-16-2022, 04:07 PM
Cosmo Cosmo is offline Removing CustomUI when saving word file from template Windows Vista Removing CustomUI when saving word file from template Office 2007
Competent Performer
Removing CustomUI when saving word file from template
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
This is what I mean.
A global template that contains the UI modifications and any related code, separate from the document template that contains the content and document format/styles.
The global could also hold building blocks that can be used to create content.
I am assuming that your UI modification is done by editing the XML of the template, not through vba on-the-fly editing. (Customize the Office Ribbon (It doesn't take rocket science) by Greg Maxey )

A global template in the Startup folder shares the UI modifications with all other documents / templates but does not insert those mods in others. They can be used.
If this is only to work with certain document templates, those templates could load the Add-In upon creation of a document and then the document template's code could unload the Add-In when the new document is closed.
Yes, the UI is done by editing the XML

Ok, so what you're saying is if i have 5 different document templates, I create the templates without code or the CustomUI, and another template with all of the code and CustomUI for all 5 documents?

Currently, i am using the 'Document_New()' event of the template (in the 'ThisDocument' Microsoft Word Objects space) to run the code to set up the document (shows a userform to collect data, and populates the document).

To move the code to a 'Master' template, I'd need to move this activation to an app event handler "App_NewDocument(ByVal Doc As Document)" event in the Master template, then I'd need to determine which template created the active document, and run the setup function(s) needed for that specific template?

Is this the proper workflow?

Edit: after thinking about this, i might be able to keep all of the code for the setup of the document in the content template, and move the rest of the UI specific code to a separate 'Master' since that's mostly for editing/updating the document once it's created. Theres's a 'New XXXX Document' button to create a new document from the specific template, but that would just need to create the document, and the rest of the code would work as usual.

I very much appreciate your assistance, and patience, with me.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Notes View into Word Template caz46 PowerPoint 0 06-24-2015 01:29 AM
Removing digitally signing when saving plasma Word 0 05-26-2015 08:36 AM
Saving a template file dreamz Word VBA 10 06-26-2014 04:38 AM
Removing CustomUI when saving word file from template Looking for best way to remove VBA and CustomUI from a file via VBA Cosmo Word VBA 1 04-25-2014 06:19 PM
Update Document Template when Saving the Document File bjbercaw Word 3 11-16-2010 02:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft