Thread: [Solved] ComboBox Variable AND list
View Single Post
 
Old 08-16-2020, 06:50 PM
Kindyr Kindyr is offline Windows 10 Office 2019
Novice
 
Join Date: Aug 2020
Posts: 12
Kindyr is on a distinguished road
Default

That was my original question, how would I do that? This is the best I've come up with and I HAVE to have the space before |Mr. or the whole thing breaks when there isn't a value created for Prefix1.

Private Sub UserForm_Initialize()
Dim myPrefixes() As String
myPrefixes = Split(" |Mr. |Ms. |Det. |Dr. |Atty. |Rabbi |Ofc. |Sgt. |Cpl. |Maj. ", "|")
Prefix1.List = myPrefixes

If Prefix1.Value = Text Then
Prefix1 = ActiveDocument.Variables("Prefix1")
Else: ActiveDocument.Variables("Prefix1") = "Mr. "
End If

End Sub
Reply With Quote