VBA issue on email send not inlcuding embeded objects

ryan_law2000

Well-known Member
Joined
Oct 2, 2007
Messages
738
everyone I have the following code that works by send the excel workbook as an attachment in an email.
The issue is the excel workbook has many embedded files within it and they are not getting sent with the email.
But if I go file share and send as attachment they are there. Any ideas how to modify this VBA to include embedded files?

Code:
Sub EmailFinalTicket()
Dim OutlookApp As Object
Dim OutlookMail As Object
Serviceline = Worksheets("Main").Range("C20")

If (Worksheets("Main").Range("C20") = "test" Or Worksheets("Main").Range("C20") = "test") Then
'If (Serviceline = "test" Or Serviceline = "test") Then
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
On Error Resume Next
With OutlookMail
    .To = ""
    .CC = "ryan"
    .BCC = ""
    .Subject = "GEAR / Job # " & Range("C6").value & " / " & Range("C7").value
    .Body = ""
    .Attachments.Add Application.ActiveWorkbook.FullName
    .Display
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End If
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Your code works for me. I created a workbook and embedded an Excel workbook, Word document, and text file. Then I ran your code. It attached the workbook to an email, I sent it to myself, and I was able to open the attachment. The embedded files were there, and I was able to open all of them. Actually, I should have included a PDF file in the testing. What type of files do you have embedded in your workbook?
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top