Re: ComboBox and UserForm_Initialize



I used the View>Toolbars>Control Toolbox. After adding the ComboBox I right
clicked , then view code. Which placed me into Visual Basic. I added the
UserForm_Initialize code as shown in the VBA help example.

Which contains:

Private Sub UserForm_Initialize ()

ComboBox1.AddItem "Above Left"
ComboBox1.AddItem "Above Center"
ComboBox1.AddItem "Above Right"
ComboBox1.AddItem "Below Left"
ComboBox1.AddItem "Below Center"
ComboBox1.AddItem "Below Right"
ComboBox1.AddItem "Centered"

'Use drop-down list
ComboBox1.Style = fmStyleDropDownCombo

'Combo box values are ListIndex values
ComboBox1.BoundColumn = 0

'Set combo box to first entry
ComboBox1.ListIndex = 0
End Sub



I also added the ComboBox1_Change and _Click code into the same window
(titled the same name as my word doc - This Document). The _Change code works
but the Dropdown List is not populated.

Should I place the Initialization code elsewhere ?

-Scott


"Doug Robbins - Word MVP" wrote:

How are you calling the UserForm?

Is it really a UserForm or have you inserted controls directly into the
document from the View>Toolbars>Control Toolbox?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Scott" <Scott@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FD64BE86-8A59-475D-9525-5BAEDC553AFD@xxxxxxxxxxxxxxxx
I am trying to implement a comboBox using the controls menu. I have writtem
a
UserForm_Initialize routine but it seems not to execute. When I click on
the
drop down all I get is a blank dropdown space with the down arrow. The
drop
down menu is not populated (initialized), However if I use the debugger to
step through the UserForm_Initialze routine all works fine the comboBox is
populated and I can make different selections. What gives? When/How is the
UserForm_Initialize routine executed? How can I force the routine to be
executed ? Or is there something else I need to do?

-Thanks in advance



.



Relevant Pages

  • Re: Selecting a Combobox Item From VBA
    ... If you mean you want one of the combobox actions to execute after you have used VBA to change the combobox value, then you are correct that nothing happens. ... If your calling VBA routine is not in the form's code then the form routine you want to execute will have to be changed from a Private routine to a Public routine. ...
    (microsoft.public.access.modulesdaovba)
  • Re: ComboBox and UserForm_Initialize
    ... How are you calling the UserForm? ... document from the View>Toolbars>Control Toolbox? ... UserForm_Initialize routine but it seems not to execute. ...
    (microsoft.public.word.docmanagement)
  • Re: OWC11 Not coming For webpage....
    ... Your parse routine should be something like this ... chart from microsoft office xp web components. ... in toolbox i do right click and i choose "choose items" from com ...
    (microsoft.public.office.developer.web.components)
  • Re: Returning an Auto Text from a Combo Box
    ... the following routine should work ... > Take a look at the code in the Private Sub UserForm_Initialize> routine ... > containing the entries "Office Location" and "Autotext". ... > the name of ComboBox1, when the userform is displayed, that combobox> will be ...
    (microsoft.public.word.vba.general)
  • Re: Idea: Multitasking graphical OS for the GS
    ... My thinking over the years has been to start with the toolbox. ... an event loop like so: ... tell the operating system when each function in your ... when the routine finishes. ...
    (comp.sys.apple2)