Hello everyone, I am trying to take a form and send it in the background using outlook. It basically sends a table to the user when an update has been made. Below is the code
<code>
Private Sub cmdsend_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Set oApp = CreateObject("Outlook.application")
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = Me.txtto
oEmail.Subject = Me.txtsubject
oEmail.Body = Me.txtbody
.Send
oApp = Nothing
oEmail = Nothing
End Sub
</code>
I have tried oEmail.Send and .Send and nothing is working. If I use .send I get an expression on click you entered as the event property setting produced the following error: Invalid or unqualified reference.
If I use oEmail.Send I get this error - Run-Time error '287':
Application-defined or object-defined error.
Then I see the outlook icon in the task bar and then goes away and nothing is sent or received. I am not sure if our Admin has locked down something or what, but I am not sure what to do to figure it out.
I have also referenced the Microsoft Outlook 15.0 Object Library
Any help or suggestions would be greatly appreciated. Thanks!!
<code>
Private Sub cmdsend_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Set oApp = CreateObject("Outlook.application")
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = Me.txtto
oEmail.Subject = Me.txtsubject
oEmail.Body = Me.txtbody
.Send
oApp = Nothing
oEmail = Nothing
End Sub
</code>
I have tried oEmail.Send and .Send and nothing is working. If I use .send I get an expression on click you entered as the event property setting produced the following error: Invalid or unqualified reference.
If I use oEmail.Send I get this error - Run-Time error '287':
Application-defined or object-defined error.
Then I see the outlook icon in the task bar and then goes away and nothing is sent or received. I am not sure if our Admin has locked down something or what, but I am not sure what to do to figure it out.
I have also referenced the Microsoft Outlook 15.0 Object Library
Any help or suggestions would be greatly appreciated. Thanks!!