View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Excel VBA Populatig UserFrom Contols as Design Time.

Sub test()
Dim arrList
Dim u As UserForm
Dim cbo As ComboBox

arrList = Array("Line 111", "Line 222", "Line 333")
Set u = ThisWorkbook.VBProject.VBComponents("UserForm1").D esigner
Set cbo = u.ComboBox1
cbo.List = arrList

End Sub

You'll need to Trust access to VB Project in your security settings. FWIW
you can design an entire Userform from scratch with the Designer object.

Regards,
Peter T

"John Howard" wrote in message
...
UserFrom1.ComboBox1 = "John Howard"

The above code populates the control ComboBox1 with the string John
Howard.
This is just a Runtime with the ComboBox not retaining the string.
What is the syntes for populating the control ComboBox at Design Time so
that the string is retained even after closing and reopening/
--
Regards
John Howard
Sydney, Australia