How do I create a custom pick list in VB for an outlook automated email?

Not open for further replies.

Gary Lewis

New Member
Outlook version
Outlook 2016 64 bit
Email Account
I have a case where the "distribution" will not change very much, and would have multiple choices. The code below is what I have so far, it appears to be working for the most part, but the only value that populates to my .TO is the values in strP0list no matter what I pick from the combobox
Sub OutageNotification()
Dim myOutlok As Object
Dim myMailItm As Object
Dim Signature As String
Dim strUsrPmt1 As String
Dim strDistroList As String
Set otlApp = CreateObject("Outlook.Application")
Set OtlNewMail = otlApp.CreateItem(olMailItem)
Dim message, title, defaultValue As String
message = "Enter your issue"
title = "Subject InputBox"
defaultValue = "No Issue"
strUsrPmt1 = InputBox(message, title, defaultValue, 25, 45)

strP0list = ";"
strP1list = ";"
strP2list = ";"
strP3list = ";"
'Get Distribution List
Select Case lstNum
Case -1
' -1 is what you want to use if nothing is selected
strDistroList = "Please enter a valid email"
Case 0
strDistroList = strP0list
Case 1
strDistroList = strP1list
Case 2
strDistroList = strP2list
Case 3
strDistroList = strP3list
End Select
'Signature = Environ("appdata") & "\Microsoft\Signatures\"
' If Dir(Signature, vbDirectory) <> vbNullString Then
' Signature = Signature & Dir$(Signature & "*.htm")
' Else:
' Signature = ""
' End If
' Signature = CreateObject("Scripting.FileSystemObject").GetFile (Signature).OpenAsTextStream(1, -2).ReadAll
OtlNewMail.HTMLBody = Signature
With OtlNewMail
.To = strDistroList
.CC = ""
.Subject = "Notification: " & strUsrPmt1
.HTMLBody = "<p><font face=""Calibri"" size=""3"">" & "<B>" & "Team-" & "<BR>" & "<BR>" & "</B>" & "<I>" & "This is an important notice about ……(Describe the impacted technology)" _
& "<BR>" & "<BR>" & "</I>" & "<B>" & "What's happening?" & "</B>" & "<BR>" & "<BR>" & "<I>" & _
"In order to continue to reduce our …… (Describe the issue or effort)" & "</I>" & "<BR>" & "<BR>" & "<B>" & "What's the impact?" & "</B>" & "<BR>" & "<BR>" _
& "<I>" & "Beginning at 8 PM EST on Friday, December 9, network and phone connectivity will be .... (Describe the impact)" & _
"</I>" & "<BR>" & "<BR>" & "<B>" & "What's not impacted?" & "</B>" & "<BR>" & "<BR>" & "<I>" & "This does not impact remote.... (Describe what is not impacted)" _
& "</I>" & "<BR>" & "<BR>" & "<B>" & "Questions?" & "</B>" & "<BR>" & "<BR>" & "<I>" & "Contact me directly for questions or concerns." & "</I>" & "<BR>" & "<BR>" & Signature
End With

Set OtlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "Distribution1"
.AddItem "Distribution2"
.AddItem "Distribution3"
.AddItem "Distribution4"
End With
End Sub
Private Sub btnOK_Click()
lstNum = ComboBox1.ListIndex
Unload Me
End Sub
Can anybody offer some assistance with this? I am an old guy trying new things, and pretty much looking for any assistance, would someone be so kind as to review and show me the error of my ways?
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Create a clickable custom column field Outlook VBA and Custom Forms 0
O Create a custom contact form - questions before messing things up... Outlook VBA and Custom Forms 4
D create an html table in outlook custom form 2010 using vba in MsAccess Outlook VBA and Custom Forms 7
L Create Custom Form Using Outlook 0
Diane Poremsky Create a custom field for Outlook messages New Articles 0
Diane Poremsky Create a Custom Numbering Field for Outlook messages New Articles 0
I Create custom Outlook 2013 Rule in Office 365 Outlook VBA and Custom Forms 5
T Create custom calendar entry form... Outlook VBA and Custom Forms 3
S Create a custom "Send" Button Outlook VBA and Custom Forms 3
E Create a URL hyperlink in an Outlook custom form? Outlook VBA and Custom Forms 2
R Can I create custom subgroups on the ribbon? Using Outlook 5
D Create additional custom flag descriptions (other than Send E-Mail, Call etc.) Using Outlook 1
J How to create a user defined dropdown list field for a custom contact form Using Outlook 3
O Outlook 2010 - How to create custom Group By Arrangements for email Using Outlook 3
P Create appointment to custom (shared) outlook calendar Outlook VBA and Custom Forms 3
C How to create a custom 'View Type' Outlook VBA and Custom Forms 7
Q How do I create a custom action for a rule? (Save as "Nfy.MSG") Outlook VBA and Custom Forms 1
O Outlook 365 - How to create / copy a new contact from an existing one? Using Outlook 3
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
A How to create fixed signatures for aliases that process through GMAIL? Outlook VBA and Custom Forms 0
P Can I create a Rule that sends me an email when I get a Task? Using Outlook 3
M How create a Rule to filter sender's email with more that one @ sign Using Outlook 1
B Can I create a local PST file for SPAM on a drive that is usually disconnected? Using Outlook 3
Chiba Create an appointment for all the members Outlook VBA and Custom Forms 1
C Can't create Outlook data file Outlook Wishlist 0
L automaticaly create a teams meeting with a sync Using Outlook 0
D Can Exchange Admin Center create a pst for users email/contacts/calendar? Exchange Server Administration 0
S Create A Search Folder That Looks For Message Class? Outlook VBA and Custom Forms 0
F How to create phone number as links in notes of Contacts Using Outlook 2
Nessa Can't create new appointment Using Outlook 1
A Create date folder and move messages daily Outlook VBA and Custom Forms 1
C Create new Message with shared contacts & BCC'ing recipients Outlook VBA and Custom Forms 0
O Multiple email accounts - hesitate to create a new profile Using Outlook 3
G Can't create Folder Groups in Outlook 2013 Using Outlook 0
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
F Delete/create/reset Exchange mailbox on Using accounts in Outlook 3
R Can not create folder to store specific emails in in Outlook for Mac Using Outlook 1
W Create Search Folder excluding Specific Email Addresses Using Outlook 5
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
K VBA BeforeItemMove event create rule to always move to its folder. Outlook VBA and Custom Forms 4
JackBlack What tools do you use to create the signature for email? Using Outlook 3
Rupert Dragwater How to create a new email with Using accounts in Outlook 32
F Should a new email account also create new contacts Using Outlook 2
R Outlook add-in to create new contact from an email. Using Outlook 0
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
Q Script to create a pst file for Archiving Using Outlook 1
Jennifer Murphy Can I create a Rule with Or'd conditions? Using Outlook 1
D Outlook macros to create meeting on shared calendar Outlook VBA and Custom Forms 10
Diane Poremsky Create a Task when a Message is Flagged New Articles 0
Stilgar Relsik Create a rule to copy text from an email and paste it in the subject line. Using Outlook 1

Similar threads