Posts: 689
Joined: Mon Aug 18, 2003 11:52 pm

Are You Good With Word? Real Good?!

Wed Dec 07, 2005 11:42 pm

Here's one for those of you that consider yourselves to be advanced Word users.

I have a form that I need to fill out like 10-15 times per day. In this form there are 6 different fields that I need to put following information in (example text within the brackets:

Flight# (SK943/08)
E.T.A (1830/08)
Master AWB# (117-40503033)
Destination (ORD)
Exit Gateway (CPH)
Special Instructions (KEEP COLD ON ARRIVAL)

Today I use a function where you press F11 to move the marker to the next field, but what I want is a dialogue box with a brief explanation of what needs to be filled in and in what format, i.e. "Please enter the estimated time of arrival in following format: HHMM/DD" and a text box where you enter the data requested and press OK. The text is then transferred to the appropriate box and the next dialogue box comes up, i.e. "Enter flight and date in following format: XX000/DD where XX is carrier code, 000 is flight No and DD is the flight date"

Is there a way to do this without using macros? Does anyone have a ready code example to send me? You can send it to, put in the subject....
Read between the lines.
Posts: 7628
Joined: Mon Feb 16, 2004 7:49 pm

RE: Are You Good With Word? Real Good?!

Thu Dec 08, 2005 2:45 am

hmm, if you had put this through the grammar checker it would have suggested replace "real good" with "really good"

Sorry, I couldn't help it but someone had to get your thread back to the top!
After Monday and Tuesday even the calendar says WTF...
Posts: 19551
Joined: Sat Oct 30, 2004 7:37 am

RE: Are You Good With Word? Real Good?!

Thu Dec 08, 2005 2:47 am

What you're really trying to do is make a word processor work like a database app, right? Why don't you just use a database app instead?
International Homo of Mystery
Posts: 6672
Joined: Mon Sep 26, 2005 9:00 am

RE: Are You Good With Word? Real Good?!

Thu Dec 08, 2005 9:05 am

If I'm not mistaken, it is possible to do exactly what you say in Excel. I've seen it done, but don't know how to do it.
When seconds count...the police are minutes away.
Posts: 2313
Joined: Fri Apr 26, 2002 11:39 pm

RE: Are You Good With Word? Real Good?!

Thu Dec 08, 2005 9:53 am

The only way you will do this is by creating a macro in VBA and setting it to run when you enter the field. Pretty straightforward:

In the VBA editor, you need to create a userform for each textbox (rt click on the "Project" pane in top left, Insert, Userform).

Design your form with question and textbox using the properties pane on the bottom left to name the question etc.

Add a button for OK, assign the following code:

ActiveDocument.FormFields.Item("text1").Result = UserForm1.TextBox1.Value

Add a cancel button if you wish with:

as the code.

Where "text1" is the name of your textbox in Word, UserForm1 is the name of your userform and Textbox1 is the name of the textbox.

In the VBA editor, add a new Sub with the following lines:

Sub Text1ShowUserform()

End Sub

Finally, in the Word Document itself, in the textbox properties under the "Run macro on entry", select "Text1showuserform" from the list.

You should then get something like this:

In this example only the first field is automated, so if you tab to the second field and Shift+tab back you will get your result.

Not entirely sure how to set the focus automatically to the next field though, the SetFocus function seems to only work for the window rather than individual controls.

All the code is there!

Hope this helps.

Posts: 389
Joined: Fri Mar 18, 2005 7:18 pm

RE: Are You Good With Word? Real Good?!

Thu Dec 08, 2005 12:48 pm

A simple but not particularly elegant way would be to use Excel and Insert comments in the cells where data is to be entered. Comments can be entered by right clicking on a cell then selecting "Insert comment" from the menu. The comments will then appear when you run the mouse cursor over the cell.

Otherwise its VBA I'm afraid. It can be done very easily if you have a basic knowledge of VBA or another modern programming language but if you are completely unfamiliar with any programming language it may seem difficult.
"I get what they call a stipend, a stipend is like money but its such as small amount they don't really call it money"

Who is online

Users browsing this forum: aerlingus747, Channex757, dazoy, Exabot [Bot], FGITD, MaverickM11 and 19 guests