Microsoft Word - automation?

%3CLINGO-SUB%20id%3D%22lingo-sub-1277422%22%20slang%3D%22en-US%22%3EMicrosoft%20Word%20-%20automation%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1277422%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20it%20possible%20to%20have%20microsoft%20word%20auto-populate%20a%20sentence%20in%20my%20word%20document%20after%20certain%20conditions%20are%20met%3F%20is%20it%20via%20VBA%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1283182%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Word%20-%20automation%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1283182%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F607318%22%20target%3D%22_blank%22%3E%40DanielWJM%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20depends%20on%20how%20the%20conditions%20are%20defined%20and%20on%20what%20you%20mean%20by%20%22auto-populate%20a%20sentence%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20many%20cases%20all%20you%20need%20is%20an%20IF%20field%2C%20which%20contains%20a%20test%20for%20some%20condition%2C%20a%20text%20string%20to%20display%20if%20the%20test%20evaluates%20to%20TRUE%2C%20and%20another%20text%20string%20to%20display%20if%20it%20evaluates%20to%20FALSE.%20Either%20or%20both%20of%20the%20text%20strings%20could%20be%20supplied%20by%20a%20field%20nested%20inside%20the%20IF%20field%2C%20such%20as%20an%20AUTOTEXT%20field%20or%20a%20REF%20field.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20VBA%20macro%20is%20an%20alternative%2C%20which%20can%20be%20useful%20if%20the%20condition%20is%20very%20complex.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you're%20doing%20this%20in%20a%20mail%20merge%2C%20the%20best%20method%20is%20often%20to%20supply%20the%20necessary%20strings%20in%20the%20merge%20data%20source%20such%20as%20an%20Excel%20worksheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20get%20an%20answer%20that's%20any%20more%20explicit%20than%20these%20general%20statements%2C%20you%20should%20reply%20with%20a%20description%20of%20exactly%20how%20you%20define%20the%20condition%20and%20how%20you%20want%20the%20resulting%20document%20to%20look%20under%20the%20possible%20situations.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi All,

 

Is it possible to have microsoft word auto-populate a sentence in my word document after certain conditions are met? is it via VBA?

1 Reply

@DanielWJM 

It depends on how the conditions are defined and on what you mean by "auto-populate a sentence".

 

In many cases all you need is an IF field, which contains a test for some condition, a text string to display if the test evaluates to TRUE, and another text string to display if it evaluates to FALSE. Either or both of the text strings could be supplied by a field nested inside the IF field, such as an AUTOTEXT field or a REF field.

 

A VBA macro is an alternative, which can be useful if the condition is very complex.

 

If you're doing this in a mail merge, the best method is often to supply the necessary strings in the merge data source such as an Excel worksheet.

 

To get an answer that's any more explicit than these general statements, you should reply with a description of exactly how you define the condition and how you want the resulting document to look under the possible situations.