473,378 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Outlook VBA .Send()( Error

I am trying to send a test e-mail through my program using Outlook so
that I know my code works and I can submit office forms through e-mail
instead of paper. Here is my code:

Dim objOutlook As New Outlook.Application()
Dim objMail As MailItem =
objOutlook.CreateItem(OlItemType.olMailItem)

With objMail
.To = "Ju********@elitefse.com"
.Subject = "Testing"
.HTMLBody = "<HTML><HEAD></HEAD><BODY bgcolor = 'red'>" _
& "<font color = 'white'>Hello!</font>" _
& "</body></html>"
'.Display()
.Send()
End With

objMail = Nothing
objOutlook = Nothing

I have
Imports Microsoft.Office.Core
Imports Outlook
above my form class

However, the .Send() method returns the following error:

'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem'
and 'Outlook.ItemEvents_10_Event'.

Does anyone know why I am getting this and how I can send my email
without the user having to click on send?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
2 3125
Ivan,
For a list of articles on using Outlook from .NET check out:

http://www.microeye.com/resources/res_outlookvsnet.htm

Specifically the following KB article addresses your problem.

http://support.microsoft.com/?kbid=315981

Hope this helps
Jay

"Ivan Weiss" <iv*****@optonline.net> wrote in message
news:eT**************@TK2MSFTNGP11.phx.gbl...
I am trying to send a test e-mail through my program using Outlook so
that I know my code works and I can submit office forms through e-mail
instead of paper. Here is my code:

Dim objOutlook As New Outlook.Application()
Dim objMail As MailItem =
objOutlook.CreateItem(OlItemType.olMailItem)

With objMail
.To = "Ju********@elitefse.com"
.Subject = "Testing"
.HTMLBody = "<HTML><HEAD></HEAD><BODY bgcolor = 'red'>" _
& "<font color = 'white'>Hello!</font>" _
& "</body></html>"
'.Display()
.Send()
End With

objMail = Nothing
objOutlook = Nothing

I have
Imports Microsoft.Office.Core
Imports Outlook
above my form class

However, the .Send() method returns the following error:

'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem'
and 'Outlook.ItemEvents_10_Event'.

Does anyone know why I am getting this and how I can send my email
without the user having to click on send?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2
Hi Ivan,

If the articles that Jay has given haven't taken you all the way, you can
do
Dim objMail As _MailItem
which makes objMail explicitly take the type that has the Send method.

or keep objMail as it is and use
DirectCast (objMail, Outlook._MailItem).Send
which uses the correct type just for the Send.

Regards,
Fergus
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mpho Molahloe | last post by:
Hi, I'm trying to send (valid) XML using the function below and get an Access Denied Message on the line objXMLHTTP.send(xmldoc) when running the aspx on a Win2003 Server but the very same code...
0
by: Chris Lane | last post by:
I am getting the following error when trying to send the mail object: COMException (0x80040213): The transport failed to connect to the server. ] System.RuntimeType.InvokeDispMethod(String...
3
by: Bob | last post by:
Hi, Win2kServer Platform I dusted off some fax sending code that used to work. The send is now returning 'The date is invalid. System.Runtime.InteropServices.COMException(0x8007000D): The data...
0
by: toduro | last post by:
Using Visual C# 2005 Express Edition and Microsoft Office Outlook 2003. An exception with message: "Retrieving the COM class factory for component with CLSID...
1
by: mubarak basha | last post by:
hi, i wrote the following coding.......... <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Getting...
2
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to...
16
by: Ed Bitzer | last post by:
Trying to send groups of email with program using System.Net.Mail. I do not clear MailMessage but repeatedly loop changing only the Bcc entries. Works fine if all addresses are valid. As a simple...
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, My C# application trys to access directorycontext during Form loading. Try and Catch if there is an exception. I then output an error message and then "this.Close();" to exit the...
1
by: beary | last post by:
Using php 5 I have access to my own php.ini file on the server I want to send any and all php errors to an email address I tried changing the line error_log = error_log to error_log = ("PHP...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.