How can I use Outlook to send email to multiple recipients in Excel VBA

前端 未结 2 1023
一向
一向 2020-12-06 11:24

I am trying to set up several buttons on an Excel form to email different groups of people. I made several ranges of cells on a separate worksheet to list the separate email

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 12:03

    ToAddress = "test@test.com"
    ToAddress1 = "test1@test.com"
    ToAddress2 = "test@test.com"
    MessageSubject = "It works!."
    Set ol = CreateObject("Outlook.Application")
    Set newMail = ol.CreateItem(olMailItem)
    newMail.Subject = MessageSubject
    newMail.RecipIents.Add(ToAddress)
    newMail.RecipIents.Add(ToAddress1)
    newMail.RecipIents.Add(ToAddress2)
    newMail.Send
    

提交回复
热议问题