View Single Post
 
Old 09-03-2021, 07:13 AM
TheBigBoss TheBigBoss is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: Dec 2016
Posts: 56
TheBigBoss is on a distinguished road
Default Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form

Hi there,

We have master templates with a defined stylesheet in six language (one template by language but same style names).

Then we have a repository of several mastheads in six language. Note each mastheads have fields/bookmarks; and they are saved as .dotx using a codification system (e.g. CLIENT-A-MEETING.docx, CLIENT-A-LETTER.docx, CLIENT-B-MEETING.docx, etc.)


Our translators are basically typing over the English.
We, in our office, do the following but manually, we want to automate it:

a) Load the stylesheet in correct language to reapply correct styles - Straightforward with VBA, however the user must at one point select which language stylesheet is to be loaded (our language variable - Arabic, Chinese, English, etc.);

b) Replace the mastheads with the official one - Deleting it the masthead is straightforward too, however the user must select which masthead is to inserted by typing the code of the template (the template variable);

c) Repopulate fields/bookmarks in the inserted mastheads - Either using 1) userform/autorenew macro to fill bookmarks; or 2) userform to replace custom property field; or 3) userform to generate XML for general XML mapping


Here is my tentative workflow with tools/features use
- The bad typed-over document is opened by the user
- The user click on the macro button in the ribbon
- A form will pop-in asking user to type his language (AR, CH, EN, FR, RU, SP)
- VBA loads and reapplies the proper styleheet from a repository
- Once done, another form pops-in asking for template code to insert the masthead)
- VBA deletes the current masthead (the first table in the content) and insert the correct masthead as building block
- Once done, a third form pops-in so that user can entered data (e.g. date, job number, meeting number, etc.) in fields/bookmarks.


Challenges/Limitation/Questions
1) Can builbing block contains fields/bookmarks?
2) We have 120 mastheads per language, can the building block.dotx support that large number of data?
3) Since I am calling directly the masthead using in VBA after entering the templace code, am I not better using InsertFile instead of building block (this will prevent me asking user to go in their AppData to do changes or to have to load all blocks data in the master template)
4) I can't use third party macro such as Graham Mayor addins


Anything I missed? Is my approach OK or is there any better way?
Thanks guys, I hope my post is clear. I am not an expert, so some guidance on best approach before I start coding would be really great.

As always, thanks for your help
Reply With Quote