Question

Word97--combo boxes

Asked by: pja15

In a table I have a column for activity codes--e.g. phone attorney has the activity code 1325; phone client-- code 4231 etc.  Probably about 50 activities with codes.  What I would like to do would be easy in Access but I'm stumpt in Word97.  In Access I would have a combo box based on a table.  The combo box would have two columns, one with the activity in English (Phone Attorney) and the second would have the activity code.  Click the row and the activity code would be saved.  Anyway to do that in Word97?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2002-08-20 at 08:29:24ID20338831
Topic

Microsoft Office Suite

Participating Experts
3
Points
200
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Saving Word97 doc's as Word6 doc's
    I'm using a template to create a document, when saving this as a Word97 doc it's 51Kb. When I save it as a Word6 doc it's 461 Kb. Also when I re-open the Word6 document the graphics are lost. I'm working on a Win95 machine with Office97 SR2. Microsoft tells in a article that...
  2. Using VBA in Word97
    I have only one table on a Word97 document. Using VBA, I want to go to the first row of this table. How do I do that? My purpose is to select the first row and then color it a shade of gray.
  3. Changing the "info-source" of the word97 letter wizard.
    I want to create a Word97 object, and automatically initialize the Letter Wizard. I then want to change the defaulted “info-source” combo, which is located in the Sender/Recipient info tabs, to connect to my Access database (or any other info source). Can this be done usin...
  4. Outline in Word97
    When using a bullet outline I cannot "backup" a level. If I indent once, then again, for a third level indent, I can only go back to the first level, or indent, I cannot have the next indent at the second level. 1. A. B. a. b. Cannot make a "C&quo...
  5. Fields and lines in Word97
    I have an Access97 to Word97 application where data from Access gets placed into DocVariables in a Word Doc. I then have fields in my Word doc that read the docvariables which fill in the fields. Here is my problem... I need this document to be only one page and even thou...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: criPosted on 2002-08-20 at 09:46:20ID: 7231276

If the users know the activity by heart: How about using the Autocorrect feature ? Like act123="Ambulance chasing"

If not: Guess you need VBA and a healthy dose of it.

 

by: bruintjePosted on 2002-08-20 at 23:51:35ID: 7232692

Hello pja15,

the first suggestion by cri sounds most pragmatic give your users a list (printed or in a textfile) and use a autocorrect list

else i would try a form with a combobox or listbox on it so user can take their pick and it will be inserted at the cursor or something

:O)Bruintje

 

by: pja15Posted on 2002-08-21 at 06:07:22ID: 7233311

The autocorrect goes the wrong way---want to save the code not plain english.  Additionally, to many codes to learn by memory.  I would like to use a combo box where it would show the plain english yet store the code in the field.  Piece of cake with Access, but don't know how to do it in Word97.

 

by: bruintjePosted on 2002-08-21 at 06:37:35ID: 7233399

ok what you can do is use the form fields again

now drop a dropdown box on your document
you can put in all the codes you need like code=description
can't put in two columns in that field

 

by: calacucciaPosted on 2002-08-21 at 06:41:32ID: 7233414

pja,

I would suggest following if you can't use the Autocorrect feature:

Put the following code in a module of the VBA part:
Sub FillFormFields()
Dim mCombo As ComboBox
Dim mArray(0 To 4, 0 To 1)
mArray(0, 0) = "1111"
mArray(1, 0) = "1112"
mArray(2, 0) = "2222"
mArray(3, 0) = "32131"
mArray(4, 0) = "5218"
mArray(0, 1) = "test1"
mArray(1, 1) = "test2"
mArray(2, 1) = "test3"
mArray(3, 1) = "test4"
mArray(4, 1) = "Ref test"
'And so on
With UserForm1
    Set mCombo = .ComboBox1
    With mCombo
        .Top = 10
        .Left = 10
        .Width = 200
        .ColumnCount = 2
        .ColumnWidths = "70;90"
        .List() = mArray
    End With
    .Show
End With
End Sub

Then create one single userform and just put one combobox on it.

Then paste the code below into the code pane of the userform:

Private Sub ComboBox1_Change()
ActiveDocument.FormFields(Selection.Bookmarks(1).Name).Result = ComboBox1.List(ComboBox1.ListIndex, 1)
Me.Hide
End Sub

Put formfield in your table, with in property's:

OnEntry you select the macro FillFormFields

Then protect the document and test.

Hope this helps
Calacuccia

 

by: calacucciaPosted on 2002-08-21 at 07:20:37ID: 7233551

I did not fully develop the code & ideas above but hope you can get it going from here, if not, please ask.

 

by: pja15Posted on 2002-08-22 at 08:05:26ID: 7236290

Looks good--won't really get a chance to work on it until the weekend.  A couple of things I'm confused on--when you say "userform" is that just a regular form or table or something else?  Also, how do I get to the field code of the userform?  Finally, you indicate "just one" combo box--I would be putting several comoboxes on the form and I'm assuming I can just do it multiple times using combobox2, 3 etc?  Sorry I need such remedial training.  Thanks.

 

by: calacucciaPosted on 2002-08-22 at 08:42:50ID: 7236423

pja,

The userform are VB(A) userforms, and it is only one combobox I am thinking off.

In fact, using comboboxes on Word tables or sheets will be a disaster. That's why I preferred to look for a method (being pushed in that direction by Bruintje's idea in your other question) which uses the events of formfields.

In fact all you will have to do is to make formfields in your table off the type I described.

All the rest will be done in VBA.

The userform is pretty selfsupporting with the code I wrote, all you will have to do is create a blank userform and put one combobox in it.

1/ Push Alt+F to open the VBA Editor
2/ Look in the project explorer (looks like the plain Windows Explorer) for the file Project(MyFile) where MyFile is the name of your Word document
3/ Right click your project(MyFile) and select Insert/Userform or select Project(MyFile) and go to the Insert/Userform menu.
4/ The little toolbox which appears contains some controls, one of which is the combobox. Just click it, and click on the left top of your userform to put it there.

Now you have created your userform with a combobox on it.

5/ Right click the UserForm1 which appears in the Project Explorer under Project(MyFile) and select 'View Code'
You will see an empty code pane on the right top
6/ Paste Code below into the empty code pane
Private Sub ComboBox1_Change()
ActiveDocument.FormFields(Selection.Bookmarks(1).Name).Result = ComboBox1.List(ComboBox1.ListIndex, 1)
Me.Hide
End Sub

7/ Now create the VB Module containing the code, right-click the Project(MyFile) anywhere in the left project explorer, and select Insert/Module

8/ Now in the right code pane, past code below

Sub FillFormFields()
Dim mCombo As ComboBox
Dim mArray(0 To 4, 0 To 1)
mArray(0, 0) = "1111"
mArray(1, 0) = "1112"
mArray(2, 0) = "2222"
mArray(3, 0) = "32131"
mArray(4, 0) = "5218"
mArray(0, 1) = "test1"
mArray(1, 1) = "test2"
mArray(2, 1) = "test3"
mArray(3, 1) = "test4"
mArray(4, 1) = "Ref test"
'And so on
With UserForm1
   Set mCombo = .ComboBox1
   With mCombo
       .Top = 10
       .Left = 10
       .Width = 200
       .ColumnCount = 2
       .ColumnWidths = "70;90"
       .List() = mArray
   End With
   .Show
End With
End Sub

9/ All left to do is to make sure that all the formfields which should have the combobox behaviour point to the macro 'FillFormFields' in there OnEnter property.

10/ Of course, the code above is not complete, you need to list all your combination of numbers & corresponding text for all 50 items you need, as I started as an example for 5 items above.

calacuccia

 

by: calacucciaPosted on 2002-08-22 at 08:45:33ID: 7236431

Some tips on creating userforms are also here, but at this point you should just fous on the things I mentioned above

http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=15

 

by: pja15Posted on 2002-08-28 at 08:35:11ID: 7246741

I'm pretty much stuck with Word because of all the other itmes I alrady have on the form plus I would need about 23 comboboxes for the rows.  bruintje, I like your idea of using a combo box, one column only, but have code=description.  How do I do that?

 

by: bruintjePosted on 2002-09-02 at 01:37:12ID: 7255896

Ok after rereading the whole thing

what i would do

-place a formfield on the document
-make it a dropdown box
-open the VB Editor with ALT+F11
-insert a new module
-then paste this code

Public Sub DropDownValue()
Dim i As Integer
Dim sVal As String
 
  sVal = ActiveDocument.FormFields("DropDown1").Result
  i = InStr(1, sVal, "=")
  sVal = Right(sVal, Len(sVal) - i)
  MsgBox sVal

End Sub

-this will return the number for the chosen action if you want to save it let me know where at least you got the number popped now
-save and close

-back in document
-manually fill the box with pairs like <action>=<number>
-then in the onexit macro box look for the DropDownValue macro and put it there

-then protect the form fields and try it out

HAGD:O)Bruintje

 

by: pja15Posted on 2002-09-03 at 12:42:33ID: 7259695

Works well and number appear in msgBox.  Would like to save the number in DropDown1 instead of the <action>=<number> text.  How would I do that last step?  thanks.

 

by: bruintjePosted on 2002-09-03 at 13:52:13ID: 7259859

well this is only showing my so-so level of word vba i can't solve it other then replacing the dropdown with a normal text field containing the number

i guess this won't be a problem if it only a fill in form if you want ot reuse it again and agian it would be a bit of a problem

Public Sub DropDownValue()
Dim i As Integer
Dim sVal As String
Dim bMark As Bookmark
  sVal = ActiveDocument.FormFields("DropDown1").Result
  i = InStr(1, sVal, "=")
  sVal = Right(sVal, Len(sVal) - i)
  Set bMark = ActiveDocument.Bookmarks("Dropdown1")
  ActiveDocument.Unprotect
  ActiveDocument.FormFields("DropDown1").Delete
  ActiveDocument.FormFields.Add ActiveDocument.Range, wdFieldFormTextInput
  ActiveDocument.FormFields("Text1").Range.Text = sVal
  ActiveDocument.Protect wdAllowOnlyFormFields
End Sub

if you want something else let me know

:O)Bruintje

 

by: pja15Posted on 2002-09-05 at 07:41:12ID: 7264686

As usual, I'm impressed.  Thanks.

 

by: bruintjePosted on 2002-09-05 at 09:05:32ID: 7264861

thank you

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...