Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE IDispatch exception code 4096 from Microsoft Outlook

Status
Not open for further replies.
Dec 6, 2001
67
JM
I am trying to send a Christmas Card email to several thousand customers, using Microsoft Outlook 2K and VFP 6.0,SP5. However, I keep getting an error:

'OLE IDispatch exception code 4096 from Microsoft Outlook.
The system cannot find the file specified.'


code is as follows:


CLOSE DATABASES
CD C:\REMIT\FILES\EXPORT*OPEN DATABASE (HOME( ) + 'ijournal2')
USE ijournal && Opens Customer table
CLEAR

SCAN FOR !EMPTY(addl_info)
*? contact, company, city


o=createobject("outlook.application")
oitem=o.createitem(0)
oitem.subject="Merry Christmas - Paymaster (Ja.) Ltd."

*oitem.to=" "
** To send copy to addresses..
oItem.cc = "technology@paymaster-online.com"
** To send Blind Copy to addresses..
oItem.bcc = addl_info
oitem.body = "You do not need to reply to this email. Your email address is confidential and has not been disclosed to any other party."

** To attach a file
oitem.Attachments.Add("C:\Remit\Files\Export\paymaster-xmax2.jpg")

** to send it
oitem.send

** to clear up
o=.null.
**********************************************************
** EOF **
*Ramani (Subramanian.G), FoxAcc, ramani_g@yahoo.com

ENDSCAN


The error comes up, and the following lines of code are highlighted:

oitem.Attachments.Add("C:\Remit\Files\Export\paymaster-xmax2.jpg")


Can someone shed some light on this situation?
Tomorrow is Christmas Eve... :(
 
oitem.Attachments.Add("C:\Remit\Files\Export\paymaster-xmax2.jpg")

I'm surprised you haven't tested it before.

[ol][li]Does the fiel actually exist?[/li]
[li]Try cutting the name down to 8 characters. And try to send one (not a thousand).[/li][/lo]

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I have used VFP to send email before; I just hadn't had the need to send attachments so I hadn't used that part of the code.(As you can see, this code is BORROWED from a Tek-Tips FAQ; the part I had tested and used before works and I assumed that the attachment part would work as well). That particular FAQ got some very HIGH ratings as well - almost 10 out of 10! :)

Any way, do you have a suggestion, based on the code posted that, that might help me out of my predicament? I figure it probably is a mistake with syntax...
 
RogerRuntings

Any way, do you have a suggestion, based on the code posted that, that might help me out of my predicament? I figure it probably is a mistake with syntax...

I have never tested Ramani's code and I wouldn't know if it works or not (I assume it works), and I would prefer Ramani answer you on that one.But since your time is at hand and if you have CDO installed, 5 minutes ago someone else wanted to do a similar thing and was asking me how to do it. And I tested the following and I get a file (as an attachment sent with no errors):

Code:
oMSG = createobject("CDO.Message")
oMSG.To = "me@nowhere.com"
oMSG.From = "me@nowhere.com"
oMSG.Subject = "Hello Email"
oAtt=oMSG.AddAttachment(“c:\myfile.txt”)
oMSG.Send()
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top