Combo Dropdown, value disappearing after userform unloads.

Trying to get a usable value from a Combo dropdown list UserForm...  after selecting the item in the userform, in Local the value does show that I want to use, however when the userform closes, it wipes out the value.  How do I keep the result of the dropdown to use it?  Any ideas??

Please advise and thanks.

Public Sub UserForm_Initialize()
    With ComboBox1
        .AddItem "CategoryType##Testing-APEX##"
        .AddItem "CategoryType##Testing-SAP##"
        .AddItem "CategoryType##Testing-API##"
        .AddItem "CategoryType##Testing-Lynx##"
        .AddItem "CategoryType##Testing-Misc##"
        .AddItem "CategoryType##Functional-APEX##"
        .AddItem "CategoryType##Functional-API##"
        .AddItem "CategoryType##Functional-Excel##"
        .AddItem "CategoryType##Functional-Lynx##"
        .AddItem "CategoryType##Functional-Misc##"
        .AddItem "CategoryType##Functional-SAP##"
    End With
End Sub
Public Sub CommandButton1_Click()
    SelectedType = ComboBox1.Value
    Unload Me
End Sub

'another procedure calls the userform1,  but Ln23 fails because the value collected in the userform disappears after the CommandButton1_Click() finishes..
       UserForm1.Show
        .Body = .Body & SelectedType & Chr(10)

Open in new window

RWayneHAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
On a Standard Module like Module1, declare SelectedType as Public Variable like below...

Public SelectedType As String

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RWayneHAuthor Commented:
Yup, that one gets me everytime...  thanks.
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.