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 03: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 04:09 PM.
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center