Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel to Populate Word Form Fields & Document

Status
Not open for further replies.

D1TrueGod

IS-IT--Management
Oct 26, 2009
3
US
I have word Form A, word Form B, and Document C. The Form Fields and the Document are primarily populated with the same data. Not all of them are necessary every time. What I want to have is a spreadsheet with cells which can be filled in and then some selections as to which forms need populated, then a button that will populate the needed forms. I've seen it done, but am having a lot of trouble trying to accomplish it myself; VBA is not my Forte!

I've heard "Mail Merge."
I've heard "Bookmarks."
I've heard "VBA."

Please, any assistance would be greatly appreciated. Thanks.
 
Well, VBA will definitely do what you want. The other options can be used along with VBA, but you can probably do it solely with VBA... I think. However, if you can get Mail Merge or Bookmarks to work for you, and you don't know any of the above, the latter 2 would be easier, I think.

From a VBA perspective, where does the initial action take place? Does the user open a Worksheet, enter some data, and then open the Word Doc and enter/copy the same data there?

Also, the forms in Word, are they forms attached to the document? Are you sure they are actual forms, and not just a series of fields plugged into the Word Doc?

If you're unsure about the Word Doc forms, you can find out this way (probably other ways as well, but this is the easiest I can think of right now):
[ol][li]Open the Word Doc with the forms.[/li]
[li]Press <Alt> + <F11> on your keyboard.[/li]
[li]This will open the VB Editor.[/li]
[li]In the VB Editor window, look on the left hand side/pane. There should be a pane that says "Project.." at the top. Under the project labeled with your current document name, are there any form objects listed? I think it'll say that it is a Form if it's there, and should have an assigned name as well.[/li]
[li]If there are form objects there, then you've got forms. If not, then no forms, just controls on the Word doc or else mail-merge/bookmark fields are already in place.[/li][/ol]

--

"If to err is human, then I must be some kind of human!" -Me
 
Actually, you can see formfields in the document; no need to use the VBE.

If they are indeed formfields, then they are a couple of ways of getting information into them.

Some clarity is needed.
I have word Form A, word Form B, and Document C. The Form Fields and the Document
"word Form A" - what does that mean, and why does it seem you are distinquishing that from "Document C".

If these are indeed formfields, then "word Form A" IS a document. All three are documents.

Secondly, how is the "Document" populated?

"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
I guess they are all documents, but the first two are protected with only form fields fillable. The third is a letter.

The first document is mandatory and is protected with fillable form fields.

The second document is optional and is also protected with fillable form fields. It uses the same basic information as the first.

The third document is an unprotected letter, also optional. This, I think, is where bookmarks will come in, the others, again I think, should be easier in VBA.

I'm putting all of the data that needs to be pushed to these documents in the same Excel column, if that helps.

Even a button per document would be fine, but you know more than I. I’m a hardware guy.

And again, thank you for your assistance! It’s greatly appreciated.
 
I still do not understand.

If two of the documents use formfields, then these are filled in by the user. Why are you wanting to fill them in by code?

In any case, the value of a formfield is .Result. Therefore, use .Result to put a value into a formfield (assuming it is a text formfield, but then you do not say what they are).

So, get the value from the cell in Excel, and put it in the .Result of the formfield.

"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
The reason that I want to use code is this:

I have 3 documents that are filled using the same information. I can save the users time if I make 1 spreadsheet that they put the info into the cells, then click a button and the info is transferred from the spreadsheet to the three documents.
 
Then for heaven's sake do NOT make them formfields in the document! Formfields are for user input. If you want to put text content at a specific location, and there is no user input, then do just that. Put the text at that location.

Or...do you want to allow the users to change the data you are bringing in from excel. In which case, yes, use formfields. But if you do not, you just want to put Excel data into a specific location...do NOT use formfields. Formfields are for user input.

As for putting ONE piece of information (from Excel) into three documents, this is not difficult.

" then click a button and the info is transferred from the spreadsheet to the three documents. "

This absolutely can be done. It is a matter of design.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top