View Single Post
 
Old 05-30-2012, 04:18 AM
jillapass jillapass is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Dec 2011
Posts: 26
jillapass is on a distinguished road
Default emailing attachement, can't get it to work

I have the following code, it emails, but doesn't include the attachment,
what have I done wrong ?


Code:
Dim bStarted As Boolean
    Dim oOutlookApp As Outlook.Application
    Dim oItem As Outlook.MailItem
      
    ' Check if Outlook is running.  If it is not, start Outlook
    On Error Resume Next
    Set oOutlookApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then
        Set oOutlookApp = CreateObject("Outlook.Application")
        bStarted = True
    End If
    MsgBox pathstring
    Set oItem = oOutlookApp.CreateItem(olMailItem)
      With oItem
        .Subject = "AFRF" + ClForename + " " + ClSurname
        .Body = "Here is your Client Review Feedback"
        .Attachments.Add Source:=pathstring, DisplayName:="AFRF"
        .To = "jill.pass@christiescare.com"
        .Send
      End With
    '  Close Outlook if it was started by this macro.
    If bStarted Then
        oOutlookApp.Quit
    End If
    'Clean up
    Set oItem = Nothing: Set oOutlookApp = Nothing
Reply With Quote