Different Word Template based on cell value

scotsrule08

New Member
Joined
Jun 21, 2018
Messages
45
Good evening,

I am needing some VBA to select the correct word merge template based on a cell value. I receive a spreadsheet with all of the data to perform a word merge. Not every row will be the same template. I need the template used to be determined by the value in column "A"

For example If the cell says "Invoice" use the template named c:\desktop\invoice2019.doc
if the cell says "RMA" use the template c:\desktop\RMAform.doc

etc. Then perform the word merge.

[FONT=&quot]Template[/FONT]
[FONT=&quot]Price[/FONT]
[FONT=&quot]Item[/FONT]
[FONT=&quot]Invoice[/FONT]
[FONT=&quot]2[/FONT]​
[FONT=&quot]BANANA[/FONT]
[FONT=&quot]RMA[/FONT]
[FONT=&quot]342[/FONT]​
[FONT=&quot]POTATO[/FONT]
[FONT=&quot]Congratulations[/FONT]
[FONT=&quot]32[/FONT]​
[FONT=&quot]CUCUMBER[/FONT]
[FONT=&quot]RMA[/FONT]
[FONT=&quot]4[/FONT]​
[FONT=&quot]SALAD[/FONT]
[FONT=&quot]Congratulations[/FONT]
[FONT=&quot]234[/FONT]​
[FONT=&quot]APPLE[/FONT]
[FONT=&quot]Invoice[/FONT]
[FONT=&quot]32[/FONT]​
[FONT=&quot] STAR FRUIT[/FONT]
[FONT=&quot]RMA[/FONT]
[FONT=&quot]28[/FONT]​
[FONT=&quot]CRUTON[/FONT]

<tbody>
</tbody>

Thank you for any assistance!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top