Run the form?

  • Thread starter slacker4officechart
  • Start date
S

slacker4officechart

I'm new to dev. I have a Document with a combobox on it and I added this code
to the vba. I can't figure how to run the form...da... I'm sure it's easy but
please help me get started...

thanks in advance,
steve

Option Explicit

Private Sub UserForm_Initialize()
With Me.ComboBox1
.AddItem "value1"
.AddItem "value2"
.AddItem "value3"
.AddItem "value4"
.AddItem "value5"
End With
End Sub
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < slacker4officechart > écrivait :
In this message said:
I'm new to dev. I have a Document with a combobox on it and I added this code
to the vba. I can't figure how to run the form...da... I'm sure it's easy but
please help me get started...

thanks in advance,
steve

Option Explicit

Private Sub UserForm_Initialize()
With Me.ComboBox1
.AddItem "value1"
.AddItem "value2"
.AddItem "value3"
.AddItem "value4"
.AddItem "value5"
End With
End Sub

Leave the cursor somewhere in the Sub

Private Sub UserForm_Initialize()

and then hit F5 to run the code, or F8 to run the code line by line
(debugging).

For more on the subject, see the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

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

Lesley Regan

Jean-Guy Marcil said:
Bonjour,

Dans son message, < slacker4officechart > écrivait :


Leave the cursor somewhere in the Sub

Private Sub UserForm_Initialize()

and then hit F5 to run the code, or F8 to run the code line by line
(debugging).

For more on the subject, see the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

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

You could also try creating a new module and inserting two lines to
dimension a new form and show it on the screen (adjusting the form's name for
your own purposes):

Sub ShowForm

Dim dlgTest As New frmStevesForm

dlgTest.Show

End Sub

Create a toolbar button for the macro, open a document, click it, and the
form will show.

Regards,

Lesley
 

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