Microsoft Word - automation?

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


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.