Okay, here's what I need to do: begin with a UserForm where the user selects an option from a ComboBox array and then hits the "OK" command button.
This triggers a sub that pulls the appropriate email addresses from a worksheet where I have them all populated.
This sub ends by creating a new email and entering those addresses in the "To" field.
Here's what I have, which does everything except for populating those addresses into the email:
Private Sub UserForm_Initialize()
RemoveCloseButton Me
ComboBox1.List = Array("905", "915", "916", "920", "921", "925", "932", "936", "937", "943", "948", "949", "951", "952", _
"953", "954", "960", "962", "966", "968", "969", "970", "971", "972", "973", "975", "976", "977", "978", "979", "980")
Me.ComboBox1.ListIndex = 0
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim Pull As String
If UserForm3.ComboBox1.Value = "905" Then
Pull = "EmailAddresses!A17"
ElseIf UserForm3.ComboBox1.Value = "915" Then
Pull = "EmailAddresses!A11"
ElseIf UserForm3.ComboBox1.Value = "916" Then
Pull = "EmailAddresses!A14"
ElseIf UserForm3.ComboBox1.Value = "920" Then
Pull = "EmailAddresses!A23"
ElseIf UserForm3.ComboBox1.Value = "921" Then
Pull = "EmailAddresses!A56"
ElseIf UserForm3.ComboBox1.Value = "925" Then
Pull = "EmailAddresses!A62"
ElseIf UserForm3.ComboBox1.Value = "932" Then
Pull = "EmailAddresses!A68"
ElseIf UserForm3.ComboBox1.Value = "936" Then
Pull = "EmailAddresses!A8"
ElseIf UserForm3.ComboBox1.Value = "937" Then
Pull = "EmailAddresses!A20"
ElseIf UserForm3.ComboBox1.Value = "943" Then
Pull = "EmailAddresses!A65"
ElseIf UserForm3.ComboBox1.Value = "948" Then
Pull = "EmailAddresses!A41"
ElseIf UserForm3.ComboBox1.Value = "949" Then
Pull = "EmailAddresses!A59"
ElseIf UserForm3.ComboBox1.Value = "951" Then
Pull = "EmailAddresses!A32"
ElseIf UserForm3.ComboBox1.Value = "952" Then
Pull = "EmailAddresses!A38"
ElseIf UserForm3.ComboBox1.Value = "953" Then
Pull = "EmailAddresses!A71"
ElseIf UserForm3.ComboBox1.Value = "954" Then
Pull = "EmailAddresses!A44"
ElseIf UserForm3.ComboBox1.Value = "960" Then
Pull = "EmailAddresses!A47"
ElseIf UserForm3.ComboBox1.Value = "962" Then
Pull = "EmailAddresses!A5"
ElseIf UserForm3.ComboBox1.Value = "966" Then
Pull = "EmailAddresses!A26"
ElseIf UserForm3.ComboBox1.Value = "968" Then
Pull = "EmailAddresses!A2"
ElseIf UserForm3.ComboBox1.Value = "969" Then
Pull = "EmailAddresses!A50"
ElseIf UserForm3.ComboBox1.Value = "970" Then
Pull = "EmailAddresses!A86"
ElseIf UserForm3.ComboBox1.Value = "971" Then
Pull = "EmailAddresses!A80"
ElseIf UserForm3.ComboBox1.Value = "972" Then
Pull = "EmailAddresses!A29"
ElseIf UserForm3.ComboBox1.Value = "973" Then
Pull = "EmailAddresses!A77"
ElseIf UserForm3.ComboBox1.Value = "975" Then
Pull = "EmailAddresses!A53"
ElseIf UserForm3.ComboBox1.Value = "976" Then
Pull = "EmailAddresses!A89"
ElseIf UserForm3.ComboBox1.Value = "977" Then
Pull = "EmailAddresses!A92"
ElseIf UserForm3.ComboBox1.Value = "978" Then
Pull = "EmailAddresses!A35"
ElseIf UserForm3.ComboBox1.Value = "979" Then
Pull = "EmailAddresses!A83"
ElseIf UserForm3.ComboBox1.Value = "980" Then
Pull = "EmailAddresses!A95"
End If
Call SendMail2
End Sub
Sub SendMail2()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Pull As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Subject = ""
.To = Pull
.CC = ""
.Display
End With
End Sub
This triggers a sub that pulls the appropriate email addresses from a worksheet where I have them all populated.
This sub ends by creating a new email and entering those addresses in the "To" field.
Here's what I have, which does everything except for populating those addresses into the email:
Private Sub UserForm_Initialize()
RemoveCloseButton Me
ComboBox1.List = Array("905", "915", "916", "920", "921", "925", "932", "936", "937", "943", "948", "949", "951", "952", _
"953", "954", "960", "962", "966", "968", "969", "970", "971", "972", "973", "975", "976", "977", "978", "979", "980")
Me.ComboBox1.ListIndex = 0
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim Pull As String
If UserForm3.ComboBox1.Value = "905" Then
Pull = "EmailAddresses!A17"
ElseIf UserForm3.ComboBox1.Value = "915" Then
Pull = "EmailAddresses!A11"
ElseIf UserForm3.ComboBox1.Value = "916" Then
Pull = "EmailAddresses!A14"
ElseIf UserForm3.ComboBox1.Value = "920" Then
Pull = "EmailAddresses!A23"
ElseIf UserForm3.ComboBox1.Value = "921" Then
Pull = "EmailAddresses!A56"
ElseIf UserForm3.ComboBox1.Value = "925" Then
Pull = "EmailAddresses!A62"
ElseIf UserForm3.ComboBox1.Value = "932" Then
Pull = "EmailAddresses!A68"
ElseIf UserForm3.ComboBox1.Value = "936" Then
Pull = "EmailAddresses!A8"
ElseIf UserForm3.ComboBox1.Value = "937" Then
Pull = "EmailAddresses!A20"
ElseIf UserForm3.ComboBox1.Value = "943" Then
Pull = "EmailAddresses!A65"
ElseIf UserForm3.ComboBox1.Value = "948" Then
Pull = "EmailAddresses!A41"
ElseIf UserForm3.ComboBox1.Value = "949" Then
Pull = "EmailAddresses!A59"
ElseIf UserForm3.ComboBox1.Value = "951" Then
Pull = "EmailAddresses!A32"
ElseIf UserForm3.ComboBox1.Value = "952" Then
Pull = "EmailAddresses!A38"
ElseIf UserForm3.ComboBox1.Value = "953" Then
Pull = "EmailAddresses!A71"
ElseIf UserForm3.ComboBox1.Value = "954" Then
Pull = "EmailAddresses!A44"
ElseIf UserForm3.ComboBox1.Value = "960" Then
Pull = "EmailAddresses!A47"
ElseIf UserForm3.ComboBox1.Value = "962" Then
Pull = "EmailAddresses!A5"
ElseIf UserForm3.ComboBox1.Value = "966" Then
Pull = "EmailAddresses!A26"
ElseIf UserForm3.ComboBox1.Value = "968" Then
Pull = "EmailAddresses!A2"
ElseIf UserForm3.ComboBox1.Value = "969" Then
Pull = "EmailAddresses!A50"
ElseIf UserForm3.ComboBox1.Value = "970" Then
Pull = "EmailAddresses!A86"
ElseIf UserForm3.ComboBox1.Value = "971" Then
Pull = "EmailAddresses!A80"
ElseIf UserForm3.ComboBox1.Value = "972" Then
Pull = "EmailAddresses!A29"
ElseIf UserForm3.ComboBox1.Value = "973" Then
Pull = "EmailAddresses!A77"
ElseIf UserForm3.ComboBox1.Value = "975" Then
Pull = "EmailAddresses!A53"
ElseIf UserForm3.ComboBox1.Value = "976" Then
Pull = "EmailAddresses!A89"
ElseIf UserForm3.ComboBox1.Value = "977" Then
Pull = "EmailAddresses!A92"
ElseIf UserForm3.ComboBox1.Value = "978" Then
Pull = "EmailAddresses!A35"
ElseIf UserForm3.ComboBox1.Value = "979" Then
Pull = "EmailAddresses!A83"
ElseIf UserForm3.ComboBox1.Value = "980" Then
Pull = "EmailAddresses!A95"
End If
Call SendMail2
End Sub
Sub SendMail2()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Pull As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Subject = ""
.To = Pull
.CC = ""
.Display
End With
End Sub