AncientTiger
Programmer
Ok, I'm at my wits end... this SHOULD be so simple, yet I've beat my head against a brick wall....
I'm trying to set up a function in my project to send emails using Microsoft Outlook 2010, and every code example I find fails.
My specs:
Here's my function code
It gets to .Recipients.ResolveAll, then gives a "Run-time error '287': Application-defined or object-defined error"
I'm not sure what else to do
Any help would be GREATLY appreciated....also, my workplace is getting Office 2013... this script SHOULD work the same with Outlook 2013, right?
------------------------------------
Over 20 years of programming, and still learning every day!
I'm trying to set up a function in my project to send emails using Microsoft Outlook 2010, and every code example I find fails.
My specs:
Windows 7 64bit
Visual Basic 6 / Visual Studios 6
I have referenced the Microsoft Outlook 14.0 Object Library (msoutl.olb)
Visual Basic 6 / Visual Studios 6
I have referenced the Microsoft Outlook 14.0 Object Library (msoutl.olb)
Here's my function code
Code:
Public Function SENDOUTLOOKEMAIL(ByVal OUTEMLIST As String, ByVal OUTSUBJ As String, ByVal OUTMSSG As String, ByVal OUTFILES As String) As Boolean
Dim oApp As Outlook.Application
Dim oEmail As Outlook.MailItem
Set oApp = New Outlook.Application
Set oEmail = oApp.CreateItem(olMailItem)
With oEmail
If BCCIT = True Then
.BCC = OUTEMLIST
Else
.To = OUTEMLIST
End If
.Subject = OUTSUBJ
.Body = OUTMSSG
.Recipients.ResolveAll
.SAVE
On Error Resume Next
.Send
If Err <> 0 Then
X = MsgBox("Error Occured: " + Err.Description)
Err.Clear
SENDOUTLOOKEMAIL = False
Else
X = MsgBox("Email Successfully Sent!!", vbInformation)
SENDOUTLOOKEMAIL = True
End If
End With
Set oEmail = Nothing
oApp.Quit
Set oApp = Nothing
Exit Function
It gets to .Recipients.ResolveAll, then gives a "Run-time error '287': Application-defined or object-defined error"
I'm not sure what else to do
Any help would be GREATLY appreciated....also, my workplace is getting Office 2013... this script SHOULD work the same with Outlook 2013, right?
------------------------------------
Over 20 years of programming, and still learning every day!