I followed the link below to set my outlook up already...
http://www.everythingaccess.com/tutoria ... ty-Warning
Then the blow script returns a runtime error 13...
on the line---> blnSuccessful = objOutlook.FnSendMailSafe(strTo,strCC,strBCC,strSubject,strMessageBody,strAttachmentPaths)
Any advise/solution is appreciated...
Thanks, Tony
VBStart
Function FnSafeSendEmail(strTo,strCC,strBCC,strSubject,strMessageBody,strAttachmentPaths)
Dim objOutlook ' Note: Must be late-binding.
Dim objNameSpace
Dim objExplorer
Dim blnSuccessful
Dim blnNewInstance
'Is an instance of Outlook already open that we can bind to?
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If objOutlook Is Nothing Then
'Outlook isn't already running - create a new instance...
Set objOutlook = CreateObject("Outlook.Application")
blnNewInstance = True
'We need to instantiate the Visual Basic environment... (messy)
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objExplorer = objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)
objExplorer.CommandBars.FindControl(, 1695).Execute
objExplorer.Close
Set objNameSpace = Nothing
Set objExplorer = Nothing
End If
blnSuccessful = objOutlook.FnSendMailSafe(strTo,strCC,strBCC,strSubject,strMessageBody,strAttachmentPaths)
If blnNewInstance = True Then objOutlook.Quit
Set objOutlook = Nothing
FnSafeSendEmail = blnSuccessful
End Function
VBEND
Let>strTo="***@fanniemae.com"
Let>strCC="***@fanniemae.com"
Let>strBCC="***@fanniemae.com"
Let>strSubject="Test"
Let>strMessageBody="Test"
Let>strAttachmentPaths="d:\*****_03_25_2009.pdf"
VBRun>FnSafeSendEmail,strTo,strCC,strBCC,strSubject,strMessageBody,strAttachmentPaths