Consulting

Results 1 to 3 of 3

Thread: Solved: noob sent email question

  1. #1
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location

    Solved: noob sent email question

    Hi, this is my first time writing a macro in outlook, can someone tell me what is wrong with this.


    [VBA]
    Option Explicit
    Sub dailyexitandarrival()
    Dim objmail As Outlook.MailItem
    Dim myattachements As Collection

    Set objmail = Outlook.CreateItem(olMailItem)
    With objmail
    .BodyFormat = olFormatPlain
    .Body = "Good Morning All, attached is Daily Exits and Arrivals. Please Click cancel when asked to updated."
    .Display
    .To = "John@smith.com"
    End With
    Set myattachements = objmail.Attachments
    myattachements.Add "C:\\daily-arrivals-exits.ppt"
    objmail.Send

    End Sub

    [/VBA]

  2. #2
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    Try this
    [VBA]
    Sub dailyexitandarrival()
    Dim objmail As Outlook.MailItem
    Dim myattachements As Collection

    Set objmail = Outlook.CreateItem(olMailItem)
    With objmail
    .BodyFormat = olFormatPlain
    .Body = "Good Morning All, attached is Daily Exits and Arrivals. Please Click cancel when asked to updated."
    .Display
    .To = "John@smith.com"
    .Attachments.Add "C:\daily-arrivals-exits.ppt"
    End With
    End Sub

    [/VBA]

  3. #3
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    thanks, works great

Posting Permissions

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