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

MS Word Linking fields

Status
Not open for further replies.

srpatel

Programmer
Mar 7, 2006
41
GB
Hello,

I dont know if I am in the right place, but I am pretty sure the task that I want to do needs some VBA in it. I am a beginner with VBA skills.

I currently have a customised Word template that is used on a daily basis which I have tried to make more user friendly by adding Auto Text pop ups based on default values.

I now have to try and get some sort of a dynamic structure in place within the template.

What I have:
[ol]
[li]Each template as a RefNo, e.g. C042. There is a list of all the RefNo used but at the moment it is manually entered.[/li]
[li]The second field on the template that needs changing is the
Location field, a description of where the C042 is located e.g From A to C. This list also exists with all the relevant RefNo.[/li]
[/ol]

Requirements:

[ul square]
[li]I would like to be able to link the RefNo and the Location field together so that when a person either writes or selects (which ever would work) the relevant RefNo, the Location field gets populated automatically with the information. [/li]

[li]Point to note, there could be more than one RefNo's referring to the same location. [/li]
[/ul square]

I think I need to create combo boxes or so but do not know how to code this.


Your help would be much appreciated.


Thanks
Shreekant


 
I have no idea what you mean by AutoText pop ups.

"Field" is a sometimes loose term.
Each template as a RefNo, e.g. C042. There is a list of all the RefNo used but at the moment it is manually entered.
This does not actually tell us much. There is a list of all RefNo used. Hmmm. I have no idea what THAT mean either. Does it mean there is a typed list in the document? Does it mean there is an external list somewhere? is this "list" a field - you don't say.
The second field on the template that needs changing is the Location field, a description of where the C042 is located e.g From A to C. This list also exists with all the relevant RefNo.
I also do not know what this means.

What kind of field is it? A formfield? A REF field? A bookmark? A description where the C042 is located. I thought C042 was just an example from a list. Now it is a noun, a "the"? "From A to C" tells us absolutely nothing. Is it relevant. What is A, what is C? I have no idea. A is some sort of location? Apparently, but what that means, I don't know.

You certainly can link information between fields. Can you describe what you are trying to do more accurately?

Field 1:

Do you want a list of some sort? If so, where is the data to populate this list?

A combobox sounds like it may be what you want. However, if you want to be to do both - enter manually, OR select an item, you will not be able to use a formfield dropdown.

Other than that it seems a simple question of logic. The user selects something, or manually enters something, and the Location field is updated. How were you imagining the Location field?


Gerry
My paintings and sculpture
 
Hello Gerry,

My apologies for a very vague topic note. Right answers to your questions:

AutoTextList is a feature in MS Word that enables users to lookup words.

Insert>AutoText.

I have created 3 different styles for other parts of the template e.g. the Product Name. I used this as guidance to create them on the template: AutoTextList

RefNo ISSUE

The current template does not have any VB or user forms. It’s one big table split up. Within a cell we have RefNo, just written where users type the reference number manually in a blank cell. The reference number relates to our products and their locations. The Location is in another cell within the table.

Yes A to C is an example of what the locations is e.g. Aisle 21 to Aisle 23

So for example:

Product Name: Structural Bolts
Ref No: B071
Location: Aisle 21 to Aisle 23


There is a list of all the Reference Numbers and Locations in an excel sheet. Each RefNo has a location. Users refer to this list and input the information into the template once all relevant data is collected.

There are approximately 400 reference numbers. I don’t expect to have a drop down / combo list of all 400 reference numbers. What I want is:
[ol]
[li]Users enter the RefNo.[/li]
[li]After the RefNo is typed in I want the Location to be automatically populated with the relevant location. [/li]
[li]If in any instance there is no location available I would like the Location cell to be defaulted to N/A[/li]
[/ol]

I hope this explains the task a bit better.

Shreekant
 
Shreekantbhai,

This should be fairly easy.

In Word you highlight

Product Name: Structural Bolts
Ref No: B071
Location: Aisle 21 to Aisle 23


Then go Insert, Autotext, Autotext

give it a name B071, click add.

Next time you are in a "blank" Word doc and type B071, Autotext entry will pop up and when you hit Enter it will be pasted.

Member- AAAA Association Against Acronym Abusers
 
Hello,

Thanks for the reply. I have mastered the Auto Text process. I have also implemented my Auto Texts so that they are only available to the template.

I need to figure out how to link the RefNo to the Location so that when the RefNo is entered the location gets populated automatically. Currently its entered like how you normally enter text in a word document.

Cheers!
 
But that's what I am saying. Either hightlight

Product Name: Structural Bolts
Ref No: B071
Location: Aisle 21 to Aisle 23

and use that as autotext or hightlight

Ref No: B071
Location: Aisle 21 to Aisle 23

and use that as autotext.

Try it, please.


Member- AAAA Association Against Acronym Abusers
 
Hi

I tried what you asked, and yes it does work, but only if they are both within the same cell or line. The way the template has been designed, the RefNo, is in a different cell from the Location.

If you highlight the B071 and hold down CTRL key to select the Location in another Cell, it does not allow to enter the Auto Text.

An example of what the template looks like within the table:

Stucture Type:Bolts [tab][tab][tab][tab][tab]RefNo:B071

Location:Ailse21 to Aisle23 [tab][tab][tab]Near:Stairs[tab][tab][tab].

Also another point to note, there about 250 of these locations and references which are populated within an excel sheet.

Any Suggestions for another solutions would be great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top