Results 1 to 2 of 2

Thread: Late Binding outlook object

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Late Binding outlook object

    i use this code to send emails via outlook, it works fine if outlook is open and returns an exception otherwise, is there a way to send emails while outlook closed
    here is my code:
    Code:
    Try
                Dim oApp, oemail As Object
                oApp = CreateObject("Outlook.Application")
                oemail = oApp.createitem(0)
                With oemail
    
                    .To ="[email protected]"
                    .CC = ""
                    .Subject = "Test Email"
                    '.BodyFormat = olFormatPlain
                    .Body = "Email Body"             
                    '.Save()
                    '.Display() 
                    .Send() 'You can automatically send the email without displaying it.
                End With
                oemail = Nothing
                ' oApp.Quit()
                oApp = Nothing
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Late Binding outlook object

    No there isn't, because it's Outlook that sends the mail. You would have to open an instance of Outlook first.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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