Excel to Open, Fill, and "package" .doc word forms

S

Susan

I'm not even sure how to word this question, but I've been given a challenge,
and I'm not sure how to go about it.

Firstly--I've created an Excel "application" that lets my underwriters fill
out information about their insured and the coverages we're insuring 1-2
times and it will auto populate throughout the rest of the different
documents (which are in separate tabs in the file) we include in an insurance
policy.

One of the documents is a form schedule--where the underwriters can choose
which forms, documentations and manuals they want to include in their package
to their insureds. This part was easy, they check off the form# they want,
hit a button, and I create a list of the forms they choose. Kind of like a
menu--they choose Form #1A, #4B, and #8C let's say. They hit OK, and I
generate a list
Forms you have selected:
#1A - Declarations Page
#4B - Schedule of Locations
#8C - Endorsement

Here's an additional feature they want. They now want the OK button to not
only generate that list, but also pull up the actual Declaration Page, or
Schedule, or Endorsement, which are .doc Microsoft word documents.

Here's my question. Is there a way for VBA in Excel to open up a Microsoft
Word Document, scan for form fields, fill it in with values from the excel
file, and package it in a PDF?

Any help or ideas would be greatly appreciated. Thanks much!
 
R

ryguy7272

Sure, you can do that, but that's a tall order, so just take it one step at a
time. Start with this...
http://word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

This too:
http://addbalance.com/usersguide/fields.htm

And this:
http://gregmaxey.mvps.org/Word_Fields.htm

Finally, once you get the DocVariable fields set up in Word (hit Alt + F9 to
see all fields), run this code from Excel.
Sub PushToWord()

Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)

With doc
..Variables("VarNumber1").Value = Range("VarNumber1").Value
..Variables("VarNumber2").Value = Range("VarNumber2").Value
'etc
..Range.Fields.Update
End With

'ActiveDocument.Fields.Update

objWord.Visible = True

End Sub

Note: This code runs in Excel; pushes Excel variables (assigned as Named
Ranges) to Word.

Regards,
Ryan--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top