ComboBox Macro Issue!?

L

LeahT

I am hoping I am posting this question to the right group. I have been
working on a word template form (Word 2003 Professional). On another
discussion group I was informed about ComboBoxes and have used three in this
particular form. Two of these are working JUST FINE...the third unfortunately
has caused me some headaches. The first problem was that when I placed all
the info in the array for the list...it for some reason refused to let me
save...stating that the disk was full (which it was not). It finally gave up
and crashed on me...forcing me to redo the combo box...this time it worked
fine and allowed me to save but now for some reason it is not showing the
list items!? They are there in VB...but when I go back to the form and
attempt to use the form...they don't show!
Any suggestions?
 
G

Greg Maxey

My first suggestion would be to show us what code you are currently
using in your attempt to populate the combooboxes in your form.
 
L

LeahT

Okay...this is the coding for one of the boxes that work:

Private Sub ComboBox1_Change()

ActiveDocument.FormFields("Text1").Result = ComboBox1.Value

End Sub

Private Sub Cmdclose_Click()

Unload Me

End Sub

Private Sub UserForm_Initialize()

ComboBox1.ColumnCount = 1

'Load data into ComboBox1

ComboBox1.List() = Array("001 ACOUSTICS/NOISE ABATEMENT", "004 AIR POLLUTION
CONTROL", "006 AIRPORTS/TERMINALS/HANGARS", "011 BRIDGES", "013 CHEMICAL
PROCESSING & STORAGE", "015 CODES/STANDARDS/ORDINANCE", _
"016 COLD STORAGE/REFRIGERATION/FAST FREEZE", "018 COMMUNICATIONS
SYSTEMS/TV/MICROWAVE", "019 COMPUTER FACILITIES/SERVICE", "021 CONSTRUCTION
MGMT", "023 COST ESTIMATING", "027 DINING HALLS/CLUBS/RESTAURANTS", _
"029 EDUC. FACILITIES/CLASSROOMS", "031 ELEVATORS/ESCALATORS", "032 ENERGY
CONSERVATION/NEW ENERGY SOURCES", "033 ENVIRO. IMPACT
STUDIES/ASSESSMENTS/STATEMENTS", "036 FIRE PROTECTION", "037 FISHERIES/FISH
LADDERS", _
"039 GARAGES/VEH MAINT FACILITIES/PARKING DECKS", "042
HARBORS/JETTIES/PIERS/TERMINALS", "043 HVAC", "046 HWYS/STREETS/AIRFIELD
PAVING/PARKING LOTS", "048 HOSP. & MED. FACILITIES", "050 HOUSING", _
"052 INDUST BLDGS/MFTRG PLANTS", "053 INDUST PROC/QCO", "054 INDUS WASTE
TREATMENT", "056 IRRIGATION/DRAINAGE", "059 LANDSCAPE ARCHTR", "062
LIGHTING", "063 MATERIALS HANDLING SYSTEMS/CONVEYORS/SORTERS", _
"071 NUCLEAR FACILITIES/SHIELDING", "072 OFFICE BLDGS./INDUSTRIAL PARKS",
"076 PETROLEUM AND FUEL", "077 PIPELINES", "079 PLANNING", "080 PLUMBING &
PIPING DESIGN", "084 PRISONS AND CORRECTIONAL FACILITIES", _
"088 RECREATION FACILITIES/PARKS/MARINAS", "089 REHABILITATION", "093 SAFETY
ENGINEERING/ACCIDENT & OSHA STUDIES", "095 SEISMIC DESIGNS & STUDIES", "096
SEWAGE COLLECTION/TREATMENT/DISPOSAL", _
"099 SOLID WASTES/INCINERATION/LAND FILL", "101 STRUCTURAL DESIGN/SPECIAL
STRUCTURES", "102 SURVEYING/PLATTING/MAPS/FLOOD PLAINS", "103 SWIMMING
POOLS", "104 STORM WATER HANDLING & FACILITIES", _
"106 TESTING & INSPECTION SERVICES", "107 TRAFFIC & TRANSPORTATION", "112
VALUE ANALYSIS/LIFE CYCLE COSTING", "113 WAREHOUSES/DEPOTS", "114 WATER
RESOURCES/HYDROLOGY/GROUND WATER", "115 WATER SUPPLY/TREATMENT/DISTRIBUTION")

End Sub

And this is the coding for the box that won't show the list:

Private Sub ComboBox3_Change()

ActiveDocument.FormFields("Text47").Result = ComboBox3.Value

End Sub

Private Sub Cmdclose_Click()

Unload Me

End Sub

Private Sub UserForm1_Initialize()

ComboBox3.ColumnCount = 1

'Load data into ComboBox3

ComboBox3.List() = Array("11331 Logging", "11531 Support Activities for
Forestry", "21221 Iron Ore Mining", "22121 Natural Gas Distribution", "23311
Land Subdivision & Land Development", "23331 Mfg & Industrial Building
Construction", "23332 Commercial & Institutional Building Construction",
"23493 Industrial Non-building Structure Construction", "23499 All Other
Heavy Construction", "23511 Plumbing, Heating, & Air-Conditioning
Contractors", "23521 Painting & Wall Covering Contractors", _
"23531 Electrical Contractors", "23541 Masonry & Stone Contractors", "23542
Drywall, Plastering, Acoustical, & Insulation Contractors", "23543 Tile,
Marble, Terrazzo, & Mosaic Contractors", "23551 Carpentry Contractors",
"23552 Floor Laying & Other Floor Contractors", "23561 Roofing, Siding, &
Sheet Metal Contractors", "23571 Concrete Contractors", "23581 Water Well
Drilling Contractors", "23591 Structural Steel Erection Contractors", "23592
Glass & Glazing Contractors", "23593 Excavation Contractors", _
"23594 Wrecking & Demolition Contractors", "23595 Building Equip. & Other
Machinery Installation Contractors", "23599 All Other Special Trade
Contractors", "31132 Chocolate & Confectionery Mfg from Cacao Beans", "31133
Confectionery Mfg from Purchased Chocolate", "31133 Confectionery Mfg from
Purchased Chocolate", "31134 Non-chocolate Confectionery Mfg", "31152 Ice
Cream & Frozen Dessert Mfg", "31192 Coffee & Tea Mfg", "31213 Wineries",
"31214 Distilleries", "31611 Leather & Hide Tanning & Finishing", _
"32211 Pulp Mills", "32411 Petroleum Refineries", "32532 Pesticide & Other
Agricultural Chemical Mfg", "32562 Toilet Preparation Mfg", "32739 Other
Concrete Product Mfg", "32742 Gypsum Product Mfg", "33992 Sporting & Athletic
Goods Mfg", "42121 Furniture Wholesalers", "42183 Industrial Machinery &
Equip. Wholesalers", "42199 Other Misc. Durable Goods Wholesalers", "42211
Printing & Writing Paper Wholesalers", "42241 General Line Grocery
Wholesalers", "42269 Other Chemical & Allied Products Wholesalers", "42272
Petroleum & Petroleum Products Wholesalers", _
"44111 New Car Dealers", "44112 Used Car Dealers", "44131 Automotive Parts &
Accessories Stores", "44132 Tire Dealers", "44211 Furniture Stores", "44511
Supermarkets & Other Grocery Stores", "44512 Convenience Stores", "44611
Pharmacies & Drug Stores", "44711 Gasoline Stations with Convenience Stores",
"44719 Other Gasoline Stations", "45291 Warehouse Clubs & Superstores",
"45299 All Other General Merchandise", "45321 Office Supplies & Stationery
Stores", "48411 General Freight Trucking, Local", "48422 Specialized Freight
(except Used Goods) Trucking, Local", _
"48423 Specialized Freight (except Used Goods) Trucking, Long-Distance",
"48611 Pipeline Transportation of Crude Oil", "48621 Pipeline Transportation
of Natural Gas", "48691 Pipeline Transportation of Refined Petroleum
Products", "48699 All Other Pipeline Transportation", "48799 Scenic &
Sightseeing Transportation, Other", "48821 Support Activities for Rail
Transportation", "49211 Couriers", "49311 General Warehousing & Storage",
"51111 Newspaper Publishers", "51339 Other Telecommunications", "52111
Monetary Authorities-Central Banks", "52211 Commercial Banking", _
"52212 Savings Institutions", "52221 Credit Card Issuing", "52222 Sales
Financing", "52413 Reinsurance Carriers", "52421 Insurance Agencies &
Brokerages", "53121 Offices of Real Estate Agents & Brokers", "53222 Formal
Wear & Costume Rental", "53249 Other Commercial & Industrial Machinery &
Equip. Rental & Leasing", "54111 Offices of Lawyers", "54136 Geophysical
Surveying & Mapping Services", "54181 Advertising Agencies", "54185 Display
Advertising", "56131 Employment Placement Agencies", "56292 Materials
Recovery Facilities", "61111 Elementary & Secondary Schools", _
"61131 Colleges, Universities, & Professional Schools", "62191 Ambulance
Services", "62211 General Medical & Surgical Hospitals", "62311 Nursing Care
Facilities", "71111 Theater Companies & Dinner Theaters", "71151 Independent
Artists, Writers, & Performers", "71391 Golf Courses & Country Clubs", "71394
Fitness & Recreational Sports Centers", "71399 All Other Amusement &
Recreation Industries", "72111 Hotels (except Casino Hotels) & Motels",
"72112 Casino Hotels", "72211 Full-Service Restaurants", "72231 Food Service
Contractors", "72232 Caterers", _
"81131 Commercial/Industrial Machinery & Equip. Repair & Maintenance",
"81221 Funeral Homes", "81222 Cemeteries & Crematories", "81341 Civic &
Social Organizations", "81391 Business Associations", "81392 Professional
Organizations", "81393 Labor Unions & Similar Labor Organizations", "81399
Other Similar Organizations (except Business, Professional, Labor, &
Political)", "81411 Private Households", "92111 Executive Offices", "92112
Legislative Bodies", "92113 Public Finance Activities", "92114 Executive &
Legislative Offices, Combined", "92219 Other Justice, Public Order, &
Safety", _
"92311 Administration of Education Programs", "92312 Administration of
Public Health Programs", "92313 Administration of Human Resource Programs",
"92314 Administration of Veterans' Affairs", "92411 Admin of Air & Water
Resource & Solid Waste Mgmt Programs", "92412 Administration of Conservation
Programs", "92511 Administration of Housing Programs", "92512 Admin of Urban
Planning & Community & Rural Development", "92611 Administration of General
Economic Programs", "92811 National Security", "92812 International Affairs",
"111998 All Other Misc. Crop Farming", _
"212111 Bituminous Coal & Lignite Surface Mining", "212112 Bituminous Coal
Underground Mining", "212113 Anthracite Mining", "212221 Gold Ore Mining",
"212222 Silver Ore Mining", "212231 Lead Ore & Zinc Ore Mining", "212234
Copper Ore & Nickel Ore Mining", "212291 Uranium-Radium-Vanadium Ore Mining",
"212299 All Other Metal Ore Mining", "212321 Construction Sand & Gravel
Mining", "212322 Industrial Sand Mining", "213113 Support Activities for Coal
Mining", "213114 Support Activities for Metal Mining", "221111 Hydroelectric
Power Generation", "221112 Fossil Fuel Electric Power Generation", _
"221113 Nuclear Electric Power Generation", "221119 Other Electric Power
Generation", "221121 Electric Bulk Power Transmission & Control", "221122
Electric Power Distribution", "311211 Flour Milling", "311212 Rice Milling",
"311213 Malt Mfg", "311222 Soybean Processing", "311223 Other Oilseed
Processing", "311225 Fats & Oils Refining & Blending", "311311 Sugarcane
Mills", "311312 Cane Sugar Refining", "311313 Beet Sugar Mfg", "311411 Frozen
Fruit, Juice, & Vegetable Mfg", "311412 Frozen Specialty Food Mfg", "311421
Fruit & Vegetable Canning", "311422 Specialty Canning", "311423 Dried &
Dehydrated Food Mfg", _
"311511 Fluid Milk Mfg", "311512 Creamery Butter Mfg", "311513 Cheese Mfg",
"311514 Dry, Condensed, & Evaporated Dairy Product Mfg", "311611 Animal
(except Poultry) Slaughtering", "311612 Meat Processed from Carcasses",
"311613 Rendering & Meat Byproduct Processing", "311615 Poultry Processing",
"311712 Fresh & Frozen Seafood Processing", "311812 Commercial Bakeries",
"311813 Frozen Cakes, Pies, & Other Pastries Mfg", "311821 Cookie & Cracker
Mfg", "311822 Flour Mixes & Dough Mfg from Purchased Flour", "311919 Other
Snack Food Mfg", "311999 All Other Misc. Food Mfg", "312111 Soft Drink Mfg", _
"312112 Bottled Water Mfg", "313312 Textile & Fabric Finishing (except
Broadwoven Fabric) Mills", "315999 Other Apparel Accessories & Other Apparel
Mfg", "316219 Other Footwear Mfg", "321113 Sawmills", "321918 Other Millwork
(including Flooring)", "321992 Prefabricated Wood Building Mfg", "321999 All
Other Misc. Wood Product Mfg", "322121 Paper (except Newsprint) Mills",
"322213 Setup Paperboard Box Mfg", "322299 All Other Converted Paper Product
Mfg", "323116 Manifold Business Forms Printing", "323119 Other Commercial
Printing", "324121 Asphalt Paving Mixture & Block Mfg", "324122 Asphalt
Shingle & Coating Materials Mfg", _
"324199 All Other Petroleum & Coal Products Mfg", "325188 All Other Basic
Inorganic Chemical Mfg", "325199 All Other Basic Organic Chemical Mfg",
"325211 Plastics Material & Resin Mfg", "325412 Pharmaceutical Preparation
Mfg", "325611 Soap & Other Detergent Mfg", "325998 All Other Misc. Chemical
Product & Preparation Mfg", "326199 All Other Plastics Product Mfg", "326299
All Other Rubber Product Mfg", "327112 Vitreous China, Fine Earthenware, &
Other Pottery Product Mfg", "327991 Cut Stone & Stone Product Mfg", "327999
All Other Misc. Nonmetallic Mineral Product Mfg", "331111 Iron & Steel
Mills", _
"332313 Plate Work Mfg", "332999 All Other Misc. Fabricated Metal Product
Mfg", "333298 All Other Industrial Machinery Mfg", "333319 Other Commercial &
Service Industry Machinery Mfg", "334513 Instr. & Related Prod. Mfg for
Measuring Displaying, & Contr. Ind. Process Variables", "334519 Other
Measuring & Controlling Device Mfg", "334612 Prerecorded Compact Disc (except
Software), Tape, & Record Mfg", "335999 All Other Misc. Electrical Equip. &
Component Mfg", "336322 Other Motor Vehicle Electrical & Electronic Equip.
Mfg", "336399 All Other Motor Vehicle Parts Mfg", "336411 Aircraft Mfg",
"336412 Aircraft Engine & Engine Parts Mfg", _
"336611 Ship Building & Repairing", "336612 Boat Building", "336999 All
Other Transportation Equip. Mfg", "337211 Wood Office Furniture Mfg", "337214
Office Furniture (except Wood) Mfg", "339992 Musical Instrument Mfg", "339999
All Other Misc. Mfg", "451211 Book Stores", "453998 All Other Misc. Store
Retailers (except Tobacco Stores)", "481111 Scheduled Passenger Air
Transportation", "481112 Scheduled Freight Air Transportation", "481211
Nonscheduled Chartered Passenger Air Transportation", "481212 Nonscheduled
Chartered Freight Air Transportation", "482111 Line-Haul Railroads", "482112
Short Line Railroads", "483211 Inland Water Freight Transportation", _
"484121 General Freight Trucking, Long-Distance, Truckload", "484122 General
Freight Trucking, Long-Distance, Less Than Truckload", "511199 All Other
Publishers", "512191 Teleproduction & Other Postproduction Services", "512199
Other Motion Picture & Video Industries", "513111 Radio Networks", "513112
Radio Stations", "522291 Consumer Lending", "522292 Real Estate Credit",
"522292 Real Estate Credit Mortgage Servicing", "522293 International Trade
Financing", "522294 Secondary Market Financing", "522298 All Other
Non-depository Credit Intermediation", "524113 Direct Life Insurance
Carriers", "524128 Other Direct Insurance (except Life, Health, & Medical)
Carriers", _
"532412 Construction, Mining, & Forestry Machinery & Equip. Rental &
Leasing", "541214 Payroll Services", "562211 Hazardous Waste Treatment &
Disposal", "562212 Solid Waste Landfill", "562213 Solid Waste Combustors &
Incinerators", "562219 Other Non-hazardous Waste Treatment & Disposal",
"623311 Continuing Care Retirement Communities", "721191 Bed-and-Breakfast
Inns", "721199 All Other Traveler Accommodation", "722211 Limited-Service
Restaurants", "722212 Cafeterias", "722213 Snack & Nonalcoholic Beverage
Bars", "999999 N/A")

End Sub


Thoughts!? Suggestions? Am I a dope and it is right in front of my face and
I am just missing something so tiny!!??
 
G

Greg Maxey

Leah,

Unfortunately I was unable to simply copy and paster your extensive
list into a form and test your code. I don't have time to reformat the
exensive list. However, why are you running UserForm1_Initialize
twice? If I moved you load Combobox3 code up to the first
Userform_Initialize routing I had no problem loading the first 20 or 30
items.

I don't know, but perhaps there is some limit to the number of items a
ComboBox can contain.

Perhaps you could try moving the load routine into the same initialize
routine that is loading the first box and see if you can load say 50,
then try 100 and so on. As you troubleshoot in this manner, you should
either be able to detemine if there is a physical limit or which one of
your list items is causing the proplem.
 
L

LeahT

Confused!? I don't see where you say I am using UserForm1_Initialize twice? I
have UserForm and UserForm1...which are two seperate Combo Boxes in the
form...one goes in Text1 and one is displayed in Text47. These are two
seperate Combo Boxes intended to fill in two seperate Text Fields in the form!

Am I misunderstanding you!? If I put the UserForm1 and UserForm information
together...wouldn't they both then show up in only ONE text field on the
form...say for instance in Text1!?
 
L

LeahT

Greg,
HAHHAHA...okay...so as I finished my reply...I went back to look at what you
were talking about...and I figured out the issue! Thank you for your help!!
 
J

Jean-Guy Marcil

LeahT was telling us:
LeahT nous racontait que :
Okay...this is the coding for one of the boxes that work:
A further suggestion, If I may, you should not have so many items in one
combo box. As a user I know I would be extremely frustrated trying to find
the one item I need...

You should have two combo boxes. One that would serve as a category list
(Meat, Sugar Products, Dairy, F& V, etc.) then when a category is selected,
only the appropriate items would be shown in the second combobox.

If this is something you want to do, let us know if you need help for the
code. If you want to try by yourself, the code in the first combobox should
be in the Change event.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top