Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-07-2015, 01:31 PM
ljg713 ljg713 is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 64bit
Novice
Generating Multiple Word Docs from Master Depending on Conditions
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Post Generating Multiple Word Docs from Master Depending on Conditions

Hello! I'm pretty new to VBA and will do my best to explain what it is I am trying to do.


I have one Master word document, that I want to use to generate 21 new word documents (each for a different account). The master document contains a large amount of text, but some of the text varies between accounts.


Whenever there is a text that varies for each account, it is highlighted in the master with [AccountName] right after it, so this text should go into the new document for that particular account. I know this is probably a very vague question, but tips and or pertinent reading materials would be very helpful.


Cheers!
Reply With Quote
  #2  
Old 12-07-2015, 04:57 PM
macropod's Avatar
macropod macropod is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Instead of using what you're calling a 'Master word document', you should be using a Word template. Templates are used for creating documents. As for the variable text, you could add a custom document property, like 'AccountName' to the template and, when you create a new document from it, simply add the relevant details to that property. Then, in the document itself, you could use field coding to conditionally show/hide the related content. Such fields might be coded as:
{IF{DOCPROPERTY AccountName}= "Company A" "Conditional content for Company A"}

Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues.

Alternatively, if whatever you're producing relates to an Excel workbook or a DATABASE that can supply the company data, you might use a mailmerge.

Without knowing more about your specific requirements, it's difficult to give tailored advice.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-08-2015, 07:36 AM
ljg713 ljg713 is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 64bit
Novice
Generating Multiple Word Docs from Master Depending on Conditions
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

Thank you so much! That seems like a great place to start.
Reply With Quote
  #4  
Old 12-09-2015, 01:36 PM
ljg713 ljg713 is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 64bit
Novice
Generating Multiple Word Docs from Master Depending on Conditions
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

Hi- replying back to this, I have been working with mail merge the last few days to accomplish the process of turning a template into 20 varied forms, and it's been a bit of a mess (mainly issues with hyperlinks and formatting, bullet points, too many blank lines).

Essentially I have a 'Guideline' document, that has the same formatting and much of the same text across all accounts, but also a large amount of varied text and links.

What I have done is make an excel spreadsheet and input each account as a row, and then across column coded it so that I can import this data through mail merge, and populate text conditionally.

I would like the final form to be user friendly if someone has to make changes to the form itself, but mail merge seems rather un-user friendly. Any other suggestions? Thanks!
Reply With Quote
  #5  
Old 12-09-2015, 02:11 PM
macropod's Avatar
macropod macropod is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by ljg713 View Post
Any other suggestions?
How about para 1 from post #2???
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 12-09-2015, 02:15 PM
ljg713 ljg713 is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 64bit
Novice
Generating Multiple Word Docs from Master Depending on Conditions
 
Join Date: Dec 2015
Posts: 20
ljg713 is on a distinguished road
Default

My boss thinks this might be inefficient because we would have to fill in the custom properties (there are about 40) for each of the 20 documents. Can you link me to somewhere where I can read more about this method though? Thanks!

Moreover, in some cases, entire paragraphs are different, it's not just an insert ____here type thing. But, I'm not sure if this makes a difference.
Reply With Quote
  #7  
Old 12-09-2015, 03:23 PM
macropod's Avatar
macropod macropod is offline Generating Multiple Word Docs from Master Depending on Conditions Windows 7 64bit Generating Multiple Word Docs from Master Depending on Conditions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The number of conditional paragraphs, etc. is irrelevant. A single custom document property, like 'AccountName', can be used to vary the content in multiple locations. you can have as many fields coded along the lines of:
{IF{DOCPROPERTY AccountName}= "Company A" "Conditional content for Company A"}
as you want. Such fields can contain multiple paragraphs, tables, images, etc.

Thus, the first such field for Company A might contain:
{IF{DOCPROPERTY AccountName}= "Company A" "First conditional content for Company A"}

the second one:
{IF{DOCPROPERTY AccountName}= "Company A" "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna."}

the third one:
{IF{DOCPROPERTY AccountName}= "Company A" "Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci."}

and so on.

If more than one of the existing documents are always produced for a given account name (or account type), those documents could be combined into one, so that all of them are produced in one go. You'd then only need to print the relevant Section(s) at any given time.

Unless you can be clearer about your requirements, one can only speak in general terms. That said, for an idea of how much can be automated, take a look at:
https://www.msofficeforums.com/word-...drop-down.html
https://www.msofficeforums.com/word-...own-lists.html
http://answers.microsoft.com/en-us/o...2-9ae21837494a
https://www.msofficeforums.com/word-...html#post85712
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating Multiple Word Docs from Master Depending on Conditions from text to table, with conditions depending on format Marco Word VBA 2 10-29-2015 06:40 PM
Generating Multiple Word Docs from Master Depending on Conditions Use multiple style sets in the same Word document (depending on which section the style is in) Ricyteach Word VBA 6 03-09-2015 07:11 PM
Add watermark to multiple word docs mykeee Word 1 09-21-2013 04:01 PM
Generating Multiple Word Docs from Master Depending on Conditions How do you update your source docs from a master document? Joyce Word 3 07-12-2013 08:54 AM
Amend footer in multiple word docs? compact Word 2 02-24-2009 09:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:21 PM.


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