Hi everybody,
I basically use this simple code that send automatically emails without opening Outlook window for it.
VBA:
Sub SendVBAMail()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
If OutApp Is Nothing Then
Set OutApp = CreateObject("Outlook.Application")
End If
On Error Goto 0
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "name@domain.com"
.Subject = "This is the Subject line"
.Body = "Hi there"
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What I'm looking for is:
How to send the email to a specific person selected from a combo box ?
I know that it's .To = "name@domain.com" that must be changed but I don't know how to make it look for a value in a combo box?!
Any help would be really appreciated!
Sincerly
iboumiza
I basically use this simple code that send automatically emails without opening Outlook window for it.
VBA:
Sub SendVBAMail()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
If OutApp Is Nothing Then
Set OutApp = CreateObject("Outlook.Application")
End If
On Error Goto 0
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "name@domain.com"
.Subject = "This is the Subject line"
.Body = "Hi there"
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What I'm looking for is:
How to send the email to a specific person selected from a combo box ?
I know that it's .To = "name@domain.com" that must be changed but I don't know how to make it look for a value in a combo box?!
Any help would be really appreciated!
Sincerly
iboumiza