Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 08-16-2020, 06:50 PM
Kindyr Kindyr is offline ComboBox Variable AND list Windows 10 ComboBox Variable AND list Office 2019
Novice
ComboBox Variable AND list
 
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
 

Tags
vba combobox



Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox Variable AND list 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 Variable AND list combobox list gets reset....please help Deepa Shrestha Word VBA 1 09-29-2013 09:30 PM
ComboBox Variable AND list Adding a long list of values to a combobox in Word 2003? ll4u76 Word VBA 1 04-13-2012 03:37 AM
ComboBox Variable AND list Populating ComboBox or Drop Down list with contents of a text field Billy_McSkintos Word VBA 1 09-13-2011 05:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft