Thread: User Form issue
View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default User Form issue

If it is opening immediately when you open the document, you must have an
autoopen() macro some where that is calling the form. If it is not in the
template for your form, it may be in an add-in, a template that you have
saved in the Word Startup folder.

To get it to appear when you enter the Country_Name field, you need to
access the properties dialog for that field and in the Run Macro On Entry
control, select your gocombobox macro.

--
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

"ah" wrote in message
...
Hi;
Thanks for your reply. However, I'm totally new to the coding.Appreciate
if
you could help to identify what are the coding that I need to add to the
below so that the combo list will only prompt out to me when I click on
the
Country_Name field, and not open automatically when I open the form. My
code
are as follows:

User Form coding:
-------------
Private Sub ComboBox1_Change()
ActiveDocument.FormFields("Country_Name").Result = ComboBox1.Value
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 1
'Load data into ComboBox
ComboBox1.List() = Array("Please select from the list", "AUSTRIA",
"BELARUS", "BELGIUM", "BULGARIA", "CROATIA", "CZECH REPUBLIC", "DENMARK",
"EGYPT", "FINLAND", "FRANCE", "GEORGIA", "GERMANY", "GREECE", "HUNGARY",
"IRELAND", "ISRAEL", "ITALY", "KAZAKHSTAN", "LATVIA", "LITHUANIA",
"MOROCCO",
"NETHERLANDS", "NIGERIA", "NORWAY", "PAKISTAN", "POLAND", "PORTUGAL",
"ROMANIA", "RUSSIA", "SAUDI ARABIAN", "SERBIA", "SLOVENIA", "SO.AFRICE",
"SPAIN", "SWEDEN", "SWITZERLAND", "TURKEY", "UAE", "UK", "UKRAINE",
"UZBEKISTAN")

Me.ComboBox1.ListIndex = 0
Me.ComboBox1.SetFocus
Me.ComboBox1.SelStart = 0
Me.ComboBox1.SelLength = Len(Me.ComboBox1.Text)

End Sub

Private Sub OK_Click()
ActiveDocument.FormFields("Country_Name").Result = Me.ComboBox1.Text
ActiveDocument.Bookmarks("Country_Name").Range.Fie lds(1).Result.Select
Unload Me
End Sub

Private Sub Reset_Click()

ActiveDocument.FormFields("Country_Name").Result = " "
ActiveDocument.Bookmarks("Country_Name").Range.Fie lds(1).Result.Select
Unload Me
End Sub

Project Module coding
----------------------------
Sub gocombobox()
UserForm.Show
End Sub