A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Vlookup in Word?



 
 
Thread Tools Display Modes
  #1  
Old December 5th, 2006, 04:29 PM posted to microsoft.public.word.tables
nquzaza
external usenet poster
 
Posts: 1
Default Vlookup in Word?

I want to make a drop down box in a word document with a list of Company
names and when a company name is selected, the fax number is displayed in the
next cell (the way you would use the Vlookup function in Excel) so that the
company name appears in one cell and the fax number in the cell next to it.
Any help would be greatly appreciated.
  #2  
Old December 5th, 2006, 07:08 PM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Vlookup in Word?

Create an autotext entry with the name of the company that contains the fax
number for each company. Then have a macro containing the following code
run on exit from the Drop Down FormField containing the company names. The
code assumes that Drop Down FormField has the bookmark name of ddCompany and
that there is a text FormField with the bookmark name of txtFax that will
display the fax number.

' Macro created 15-11-97 by Doug Robbins to add the address corresponding to
a drop down name
'
Dim cmbCompany As DropDown
Dim Company As String
Dim Fax As String
Set cmbCompany = ActiveDocument.FormFields("ddCompany").DropDown
Company = cmbCompany.ListEntries(cmbCompany.Value).Name
Fax = ActiveDocument.AttachedTemplate.AutoTextEntries(Co mpany).Value
ActiveDocument.FormFields("txtFax").Result = Fax


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"nquzaza" wrote in message
...
I want to make a drop down box in a word document with a list of Company
names and when a company name is selected, the fax number is displayed in
the
next cell (the way you would use the Vlookup function in Excel) so that
the
company name appears in one cell and the fax number in the cell next to
it.
Any help would be greatly appreciated.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.