How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Greg Maxey Your Own Question

Greg Maxey
Greg Maxey, Consultant\Microsoft Word Expert
Category: General
Satisfied Customers: 62
Experience:  Microsoft Word Most Valuable Professional (6 years)
16468162
Type Your Question Here...
Greg Maxey is online now
A new question is answered every 9 seconds

Ask a Microsoft Word Question when I create a combobox in

Resolved Question:

Ask a Microsoft Word Question
>when I create a combobox in Word 2007 and add the values in VBA, the values show up, but when I save the file and reopen...the combobox's are empty.....any suggestions?
Submitted: 5 years ago.
Category: General
Expert:  Greg Maxey replied 5 years ago.
Because of an ambiguous what? I won't be able to assit you further without a clear understanding of the problem. What kind of combobox? Content control or activeX control. What VBA code are you currently using.
Customer: replied 5 years ago.
I am trying to make an General form for ordering Eyeglasses. I have Ten activex ComboBoxes. I need to be able to have them pull down the info and fill out form and send it to me.(They will have this form on microsoft 2007) I currently have them sending me a similar version without comboboxs but they have to fill in a lot of items that are ordered frequently. This has been a really frustrating experience, just trying to add a pull down menu! And I don't like the look of the Content control box's.

I have used the VBA :example

Private Sub Document_Open()
ComboBox1.Clear
ComboBox1.AddItem "Select"
ComboBox1.AddItem "SV"
ComboBox1.AddItem "PAL"
ComboBox1.AddItem "Bifocal"
ComboBox1.AddItem "Trifocal"
ComboBox1.Value = "Select"
ComboBox2.Clear
ComboBox2.AddItem "Select"
ComboBox2.AddItem "TruClear"
ComboBox2.AddItem "TruClearHD"
ComboBox2.AddItem "Definity"
ComboBox2.AddItem "DefinitySht"
ComboBox2.AddItem "Comfort2"
ComboBox2.AddItem "Other"
ComboBox2.Value = "Select"
End Sub

It said ambigous name, because I have two Document_open, so I pilled them all into one.

I have also tried
separating them
With combobox
End With
End Sub

Thanks
Expert:  Greg Maxey replied 5 years ago.

Your form won't work with the code you have because everytime the document is opened the contents of the combobox list is 1. Cleared. 2. Recreated and 3. "Select" is set as the active value.

 

You should be creating new form documents using a template. In the template "ThisDocument" project module place the following code:

 

 

Private Sub Document_New()
ComboBox1.Clear
ComboBox1.AddItem "Select"
ComboBox1.AddItem "SV"
ComboBox1.AddItem "PAL"
ComboBox1.AddItem "Bifocal"
ComboBox1.AddItem "Trifocal"
ComboBox1.Value = "Select"
ComboBox2.Clear
ComboBox2.AddItem "Select"
ComboBox2.AddItem "TruClear"
ComboBox2.AddItem "TruClearHD"
ComboBox2.AddItem "Definity"
ComboBox2.AddItem "DefinitySht"
ComboBox2.AddItem "Comfort2"
ComboBox2.AddItem "Other"
ComboBox2.Value = "Select"
End Sub

 

Private Sub Document_Open()
Dim valCB1 As String
Dim valCB2 As String
valCB1 = ComboBox1.Value
valCB2 = ComboBox2.Value
ComboBox1.Clear
ComboBox1.AddItem "Select"
ComboBox1.AddItem "SV"
ComboBox1.AddItem "PAL"
ComboBox1.AddItem "Bifocal"
ComboBox1.AddItem "Trifocal"
ComboBox1.Value = valCB1
ComboBox2.Clear
ComboBox2.AddItem "Select"
ComboBox2.AddItem "TruClear"
ComboBox2.AddItem "TruClearHD"
ComboBox2.AddItem "Definity"
ComboBox2.AddItem "DefinitySht"
ComboBox2.AddItem "Comfort2"
ComboBox2.AddItem "Other"
ComboBox2.Value = valCB2
End Sub

 

Greg Maxey and 56 other General Specialists are ready to help you

Related General Questions