Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-03-2021, 07:13 AM
TheBigBoss TheBigBoss is offline Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Windows 7 32bit Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Office 2010 32bit
Novice
Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form
 
Join Date: Dec 2016
Posts: 23
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
  #2  
Old 09-03-2021, 03:46 PM
Guessed's Avatar
Guessed Guessed is offline Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Windows 10 Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,726
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

I wouldn't use fields and bookmarks. I would use Content Controls instead. With those content controls, I would also probably map them to a custom XML file. A solution might involve a library of language/masthead specific XML files which could be substituted into the file to implement the changes.

I would not create three separate userforms - the same userform should do language, masthead and data fields in one action.

As to your Challenges/Limitation/Questions
1) Can building block contains fields/bookmarks? Yes they can but it is easier and cleaner to use mapped content controls
2) We have 120 mastheads per language, can the building block.dotx support that large number of data? Yes they can but if you are going to multiply this by 6 for each language, I would recommend you put each language set in a different template/addin and load the required one only.
3) Since I am calling directly the masthead using in VBA after entering the template 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). I don't understand this question, you must be distributing the template(s) to the users somehow already so why would this be a problem?
4) I can't use third party macro such as Graham Mayor addins Bummer dude! Yet you ask third parties for advice on this forum. Does this mean we can't provide you code samples or advice? You are welcome to recreate all this functionality from scratch - it's not my time or money you are spending to do so
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 09-06-2021, 05:10 AM
TheBigBoss TheBigBoss is offline Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Windows 7 32bit Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Office 2010 32bit
Novice
Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form
 
Join Date: Dec 2016
Posts: 23
TheBigBoss is on a distinguished road
Default

Thanks for your reply Guessed.

Ahahaha, I know it's a bummer but what can I do? We have strict policies.

I shall indeed try to start from scratch... this said, it does not prevent you from assisting nor sharing codes, if required, as I am here unofficially

I will report back on progress made and post any challenges I face if any.

Thanks a lot
Reply With Quote
  #4  
Old 09-07-2021, 06:10 AM
gmayor's Avatar
gmayor gmayor is offline Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Windows 10 Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Office 2019
Expert
 
Join Date: Aug 2014
Posts: 3,620
gmayor is a splendid one to beholdgmayor is a splendid one to beholdgmayor is a splendid one to beholdgmayor is a splendid one to beholdgmayor is a splendid one to beholdgmayor is a splendid one to beholdgmayor is a splendid one to behold
Default

While I have spent the last 20 years or so encouraging and assisting amateur programmers, I have never understood the mentality of companies who refuse to allow staff to download tools written by professional programmers, but are quite content to allow inexperienced amateurs to potentially wreak havoc on their systems by dabbling in programming techniques they barely understand.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 09-07-2021, 06:30 AM
TheBigBoss TheBigBoss is offline Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Windows 7 32bit Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Office 2010 32bit
Novice
Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form
 
Join Date: Dec 2016
Posts: 23
TheBigBoss is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
While I have spent the last 20 years or so encouraging and assisting amateur programmers, I have never understood the mentality of companies who refuse to allow staff to download tools written by professional programmers, but are quite content to allow inexperienced amateurs to potentially wreak havoc on their systems by dabbling in programming techniques they barely understand.
I totally agree with your statement, I wish I could do otherwise and use already developped robust tool.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to create a user form and populate it with a field from the main document? NMGMarques Word 3 02-12-2020 06:08 PM
Generate template-based letter with multiple variables shallaes Word VBA 5 07-12-2018 12:18 AM
Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form Content Control Field Names/Titles Word Form shammi_raj Word VBA 3 03-10-2016 02:54 AM
form control Field - Drop down auto text mrtinfl Word 5 11-19-2014 06:57 AM
Use document property as condition in IF field? ChrisBrewster Word 2 01-29-2014 10:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:16 PM.


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