I am working on sending an email based on inputs from one of several sheets.

In addition to the specific cells i am using as body, a various sheet may 
have an embedded file (word, pdf, another excel spreadsheet and maybe more).

How do I attach and embedded OLEObject or OLEObjects into that email from 
the selected sheet?  I have highlighted in red my problem area.  This will 
run.  But the issue is that it doesn't attach any file to the email.

Thanks in advance.

below is my code so far...

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
Application.ScreenUpdating = False

With OutMail

    .BodyFormat = olFormatRichText
    
    .Subject = 
wbDestination.Sheets(strType).Range(cCELLFOREMAILSUBJECTLINE).Value

    strTemp1 = getToEmailNames(individual)
    .To = getEmailNamesBasedOnArrayOfNames(strTemp1)
    
    strTemp2 = getCCEmailNames(individual)
    If Len(strTemp2) > 0 Then
        .CC = getEmailNamesBasedOnArrayOfNames(strTemp2)
    End If
    
    .body = getEmailBody(strType,)
    
    

*    For Each oEmbFile In wbDestination.Sheets(strType).OLEObjects*
*        Set oAttachObject = oEmbFile.Object*
*        .Attachments.Add oAttachObject, 6*
*    Next*
    
    If frmSendNotification.chkSendEmailWithOutDisplay.Value = False Then
        .Display
    Else
        .Send
    End If
    
    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
    
End With

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to