VBA to insert contract language into embedded word docs and save as PDF

bcf0123

New Member
Joined
May 13, 2020
Messages
5
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hi All,

I'm new to the boards and I have limited knowledge in VBA. I just got an in depth book on the topic and am working through it. I wanted to get some thoughts and code to start for this project. I have an Excel tool that models out profitability for one of our products. I want to be able to automate the contract language that is currently done manually in Word (based on many criteria in the Excel model). There are many variables that go into creating the contracts. Here are my thoughts on how to go about setting this up, but just not sure if it's feasible and how it would get done in VBA.
  1. Embedded word doc with the standard contract language that begins each contract
  2. Variable 1 - Is the deal global or North America only? I'd have a toggle Yes/No here. If Yes, pull the language for this from another embedded word document and paste into the contract.
  3. Variable 2 - Is there a bonus? Yes/No toggle (same as above). The bonus would also need to be copied into the contract language.
  4. Etc with the many variables
  5. I'd also need a few things copied from the actual file. There would be a table that needs inserted to the word document.
  6. After all variables are answered yes/no and the word document is populated, it will need to be saved down as a PDF so it cannot be edited.
Due to company policy, I can't post the working file to any public boards. Any help would be appreciated.
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,951
Have you looked at Word and Excel's Mail Merge, where a Word doc can be created with blank fields to be filled by particular cells in an Excel file?
 

bcf0123

New Member
Joined
May 13, 2020
Messages
5
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Have you looked at Word and Excel's Mail Merge, where a Word doc can be created with blank fields to be filled by particular cells in an Excel file?
I will take a look at this. I'm wondering if the formatting will look bad after going into the word document.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,951
The data gets transfered as characters, not images. The formatting will look like a normal Word document.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,040
Messages
5,622,343
Members
415,894
Latest member
silverhaze

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
Top