Results 1 to 2 of 2

Thread: [RESOLVED] Outlook late binding

  1. #1

    Thread Starter
    Addicted Member Veritas2.0's Avatar
    Join Date
    May 2008
    Posts
    181

    Resolved [RESOLVED] Outlook late binding

    I'm trying to add a function that will send a warning email when something goes wrong. I have read robDogs example on how to send email using outlook and I'm trying to modify it to use late binding instead.
    Code:
    Private Sub SendEmail(ByVal workcenter As Integer, ByVal time As Date)
        Dim objApp As Object
        Dim objEmail As Object
        Set objApp = CreateObject("Outlook.Application")
        Set objEmail = CreateObject("Outlook.MailItem")
        With objEmail
            .To = "[email protected]"
            .Subject = "Multiple Shop Orders run for line " & workcenter & " at " & time
            .body = "TEST"
            .send
        End With
        Set objEmail = Nothing
        Set objApp = Nothing
        
    End Sub
    However when it gets to the line were I'm creating the MailItem Object the program throws the error "ActiveX component cannot create object". How do I fix this?
    Simple little bugs 13 : Me 1

    Law of Bugs - That one bug you missed will be found almost immediately, by your customer.

    I wonder if anyone has ever asked for a User Surly interface?

  2. #2

    Thread Starter
    Addicted Member Veritas2.0's Avatar
    Join Date
    May 2008
    Posts
    181

    Re: Outlook late binding

    Nevermind I looked around a bit more and found it.

    I needed to change the line from this:
    Code:
    Set objEmail = CreateObject("Outlook.MailItem")
    to this:
    Code:
    Set objEmail = objApp.CreateItem(0)
    Simple little bugs 13 : Me 1

    Law of Bugs - That one bug you missed will be found almost immediately, by your customer.

    I wonder if anyone has ever asked for a User Surly interface?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width