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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select individual record from Excel data to merge in Word

Status
Not open for further replies.

snowxf

Technical User
Jan 5, 2005
20
0
0
US
Is there a way to use only one record from an Excel sheet to populate fields in a Word document? (I'm running 2003, but other users in the office have 2000.)

More specifically, I have an Excel sheet that lists companies and their corresponding address book information per record. Letters and memos are frequently drafted, and I'd like to know if there's a way to automate this process more so addresses don't have to be typed repeatedly. I don't think mail merge will work because it's only one letter I'm sending out at a time for specific issues. Is there something along the lines of a combo/drop-down menu box that can be used?
 
Sure it can. How are you generating the Word document? A field in a Word document just accepts information. As long as you can show it to the field, it will happily take it.

Gerry
 
I'd be using a template in Word to generate each document, and changing the contents of the body accordingly. After fumei's reply about fields, I did some experimenting with fields and forms, but for the drop-down form, I found it only takes a static list through the form's properties. Is there a way to dynamically link to the Excel records? (So that a user can click on the form in, say, the Company_Name field, scroll through the list, select the appropriate record, and the Company_Name field is then filled with the Company Name, as well as Address1 with the record's Address1, Address2, ...etc?)
 
Do you mean a drop down in Word that will dynamically go get further records in Excel?

You are correct that Form Field drop downs are populated through properties. However, you can populate through code.

As alternative you can populate a ActiveX control (dropdown - called a combobox) through code.

OK. You are starting FROM Word. You want to then create an instance of Excel and open a file. I am not an Excel guy, so you may want to ask for help in that area.

However, in Word, you can certainly populate a drop down with a dynamic item list. And you can certainly take the result of a selected item and fill in other fields with information - as long as you can get that data from Excel.

Gerry
 
Okay, cool. So, I haven't used ActiveX controls before. I've done stuff in VB through Access, and created some Macros in Word and Excel. Is it similar? Or rather, for an ActiveX control, do I simply insert one and edit its properties/code in the Visual Basic editor? Or is it more complicated than that and I should just create a combo box in Word, then write code behind it for automation?
 
Snowxf, I am trying to do the same thing as you with a database in Excel and a form in Word. I would like to know if you were able to solve your problem and how you did it. Thanks.
 
Still working on it (I've been a bit distracted on other stuff), but I'll let you know if (when!) I get to the bottom of it!
 
I appreciate it. I will do the same. This little project isn't real high on my priority list either. It is not part of my regular job but a dept. has asked me if I could help them out. Thanks again!
 
Yes, use the Controls toolbar in Word (View > Toolbars > Controls). Use a Combobox. Please note that ActiveX control events are found in the ThisDocument module. You can not access them from standard modules. However, you can write procedures in the ThisDocument module, and call them from a standard module.

You edit the properties with a right click (Properties), and edit the code with a right click (View code).

Depending on your requirements you may want to populate the combobox with the Document_Open event, also in the ThisDocument module.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top