VB6 and MS Office 2007


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: VB6 and MS Office 2007

  1. #1
    Join Date
    Aug 2004
    Posts
    54

    VB6 and MS Office 2007

    Hi,
    I am trying to send e-mail using vb6, and my default e-mail application is Outlook 2007.
    My code:
    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)


    With oitem
    .Subject = "Test Email Using VB and Outlook Object"
    .To = "myemailadress@xxx.com"
    .Body = "This message was sent from VB"
    .Send
    End With
    Set olapp = Nothing
    Set oitem = Nothing
    Exit Sub
    ErrHnd:
    Debug.Print Err.Number & Err.Description
    End Sub

    when I click the button, I receive an error number 287 (Application-defined or object-defined error)
    any help!!!
    Last edited by moe188; 11-15-2007 at 03:07 PM.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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?

    http://www.freevbcode.com/ShowCode.Asp?ID=773
    http://support.microsoft.com/kb/161833
    Last edited by Phil Weber; 11-15-2007 at 04:09 PM.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center