![]() |
|
|
|
#1
|
||||
|
||||
|
Your code is filling the values which show in the list. It isn't setting the default value because you haven't asked it to.
You set the default by populating the value after the list is applied Code:
Private Sub UserForm_Initialize()
Dim myPrefixes() As String
myPrefixes = Split(" |Mr. |Ms. |Dr.", "|")
Prefix1.List = myPrefixes
Prefix1 = "Mr. "
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#2
|
|||
|
|||
|
Funny story... that is exactly how I had it set up and it was returning an error to me 5 hours ago. I closed it, went about other business, came back to check if what suggested might be in any way different from what I had already put, and it was working with no issues.
As for the inconsistent spaces, I had trimmed the list to make it simplified. The list was much longer and I chopped out about 7 other prefixes, they all have the space after them because it will print to the document with the space between the prefix and the person's name. Thank you for your help, it actually worked and just made me look at what was already there again instead of scrapping what I had. Private Sub UserForm_Initialize() Dim myPrefixes() As String myPrefixes = Split(" |Mr. |Ms. |Det. |Dr. |Atty. |Rabbi |Ofc. |Sgt. |Cpl. |Maj. ", "|") Prefix1.List = myPrefixes Prefix1 = ActiveDocument.Variables("Prefix1") End Sub |
|
| Tags |
| vba combobox |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Excel Combobox List
|
VBA-User | Excel Programming | 4 | 01-07-2016 02:46 AM |
| Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge | Berryblue | Mail Merge | 1 | 11-13-2014 05:36 PM |
combobox list gets reset....please help
|
Deepa Shrestha | Word VBA | 1 | 09-29-2013 09:30 PM |
Adding a long list of values to a combobox in Word 2003?
|
ll4u76 | Word VBA | 1 | 04-13-2012 03:37 AM |
Populating ComboBox or Drop Down list with contents of a text field
|
Billy_McSkintos | Word VBA | 1 | 09-13-2011 05:50 AM |