VB6 and MS Office 2007
I am trying to send e-mail using vb6, and my default e-mail application is Outlook 2007.
Private Sub cmdMailSend_Click()
On Error GoTo ErrHnd
Dim olapp As Outlook.Application
Dim oitem As Outlook.MailItem
Set olapp = New Outlook.Application
Set oitem = olapp.CreateItem(olMailItem)
.Subject = "Test Email Using VB and Outlook Object"
.To = "firstname.lastname@example.org"
.Body = "This message was sent from VB"
Set olapp = Nothing
Set oitem = Nothing
Debug.Print Err.Number & Err.Description
when I click the button, I receive an error number 287 (Application-defined or object-defined error)
Last edited by moe188; 11-15-2007 at 04:07 PM.
I just ran the code on my system and it worked without error, so the problem is not with the code.
Do you have to use the Outlook object model to send your message? Why not use one of the methods below?
Last edited by Phil Weber; 11-15-2007 at 05:09 PM.
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL