John_McClane
New Member
- Joined
- Apr 30, 2013
- Messages
- 27
Good Afternoon,
I am using the following code from Locke-Garmin to automatically populate textboxs:
Code:
...which works perfectly. I am using the userform to send an email with the information now input from the code above and would like it to send the value of combobox1 as part of the body. However, when I use me.combobox1.value it is returning the value as the email address of the person and not the name - is there a way for it to return the name instead?
If it would be helpful I can post the code I am using to send the email.
Thank you in advance for your time and help,
John
I am using the following code from Locke-Garmin to automatically populate textboxs:
Code:
Option Explicit
Private People As Collection
Private Sub UserForm_Initialize()
Set People = New Collection
Call PopulatePeopleCollection
With ComboBox1
.List = People_Collection_To_List()
.ColumnCount = 2
.BoundColumn = 2
.ColumnWidths = "1;0"
End With
End Sub
Private Sub PopulatePeopleCollection()
AddPerson "Locke", "Locke@Locke.com"
AddPerson "Garmin", "Garmin@Garmin.com"
End Sub
Private Sub AddPerson(Name As String, Email As String)
People.Add Array(Name, Email)
End Sub
Private Function People_Collection_To_List() As Variant()
Dim ReturnArray As Variant
Dim x As Long
ReDim ReturnArray(1 To People.Count, 0 To 1)
For x = 1 To People.Count
ReturnArray(x, 0) = People(x)(0)
ReturnArray(x, 1) = People(x)(1)
Next x
People_Collection_To_List = ReturnArray
End Function
Private Sub ComboBox1_Change()
TextBox1.Value = ComboBox1.Value
End Sub
...which works perfectly. I am using the userform to send an email with the information now input from the code above and would like it to send the value of combobox1 as part of the body. However, when I use me.combobox1.value it is returning the value as the email address of the person and not the name - is there a way for it to return the name instead?
If it would be helpful I can post the code I am using to send the email.
Thank you in advance for your time and help,
John