Results 1 to 2 of 2

Thread: Outlook Send Email to Listbox Name

  1. #1

    Thread Starter
    Registered User
    Join Date
    Mar 2022
    Posts
    1

    Outlook Send Email to Listbox Name

    I am new to VBA and have been searching google for an example close to my needs. I am wanting to create VBA script (to run in Outlook not Excel) to send an email template that has the email address and body already inputed. Once the name is selected from the listbox it will send the template.
    I have been able to populate the list box and Send an email template but not the 2 together.

    HTML Code:
    Private Sub UserForm_Initialize()
    'Creates and assigns the Array to the ListBox when the form loads. Dim mylist As Variant
    
    mylist = Array("TEST", "Monday", "Tuesday", "Wednesday", _ "Thursday", "Friday", "Saturday") ListBox1.List = mylist
    
    End Sub
    
    Private Sub CommandButton1_Click() 'First Method: Displays individual selections one at a time. For x = 0 To ListBox1.ListCount - 1
    
      If ListBox1.Selected(x) = True Then
         MsgBox ListBox1.List(x)
      End If
    Next x Unload Me
    
    End Sub

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,807

    Re: Outlook Send Email to Listbox Name

    Just a quick tip: there's no need to test for " = True"

    "If ListBox1.Selected(x) Then" will do.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width