473,834 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Applica tion()
Dim objMail As MailItem =
objOutlook.Crea teItem(OlItemTy pe.olMailItem)

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

objMail = Nothing
objOutlook = Nothing

I have
Imports Microsoft.Offic e.Core
Imports Outlook
above my form class

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

'Send' is ambiguous across the inherited interfaces 'Outlook._MailI tem'
and 'Outlook.ItemEv ents_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 3162
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*****@optonl ine.net> wrote in message
news:eT******** ******@TK2MSFTN GP11.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.Applica tion()
Dim objMail As MailItem =
objOutlook.Crea teItem(OlItemTy pe.olMailItem)

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

objMail = Nothing
objOutlook = Nothing

I have
Imports Microsoft.Offic e.Core
Imports Outlook
above my form class

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

'Send' is ambiguous across the inherited interfaces 'Outlook._MailI tem'
and 'Outlook.ItemEv ents_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._MailIt em).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
1966
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 works on Win2000 server. Private Function SendToSS3(ByVal Input As String) As String Dim xmldoc As New MSXML2.DOMDocument40 Dim objXMLHTTP As New MSXML2.ServerXMLHTTP40
0
1131
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 name, BindingFlags invokeAttr, Object target, Object args, Boolean byrefModifiers, Int32 culture, String
3
5582
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 is invalid as FAXCOMLIB.IFaxDoc.Send() (Code Below) I recently just installed a PCI modem card for the test. However it sends
0
4776
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 {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 8007007e" is thrown during processing of the statement: "Microsoft.Office.Interop.Outlook.Application outlook_app = new
1
5036
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 Server side data using AJAX</title> </head> <script>
2
17499
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 the bare minimum: System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("<my mail server IP>", 25); smtp.Send("<one of my email addresses>", "<another of my email addresses>", "Hello", "World");
16
1677
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 test I have attempted to send a valid address, then an invalid address which my ISP (Comcast) will reject immediately as "Not our customer". I catch the exception, display and then continue looping to send several additional valid. The balance...
0
1251
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 application. But, as my applicaiton closes, the MS dialog comes up asking to send Error Report to MS. I tried using ThreadException event code from: http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx But I'm...
1
2502
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 error", 1, "myemail@mydomain.com") but it hasn't worked. I basically just would like to know what my oho.ini file needs to have in order to send an email rather than logging to a file.
0
10789
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10504
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10544
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5624
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3079
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.