RE: Insert/Embed outlook mail using vba Excel

Keerthi03

New Member
Joined
Jun 14, 2020
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Hi Folks,

I would need your dearest help in vba code . For your kind info - I need urgent help on this query. Hence, I have already cross posted the same query in other forum earlier (refer link below):

Other Forum - Cross Post

I would need to perform additional task along with existing steps which i have mentioned below for your reference:

Existing step:
I would need to insert the outlook email message(saved in the same path as of my macro file as .msg format) as object into the excel worksheet.

Existing code of mine -( This code only insert email into worksheet as object - Need to make it dynamic to choose the email file name)

VBA Code:
Sub test()

Dim XPath As String
Dim Email As String
XPath = Application.ActiveWorkbook.Path
Email = XPath & "\Monthly sales.msg"
ActiveSheet.OLEObjects.Add(Filename:=Email, Link:=False, DisplayAsIcon:=True, IconFileName:= _
        "C:\WINDOWS\system32\packager.dll", IconIndex:=2, IconLabel:= _
        "Monthly sales.msg").Select
    Range("K7").Select
    
    End Sub


Addiontal task:
1) I would need to attach 3 more files (it will be 3 different worksheet and one email) in the same email message which i am about to add as object in VBA excel worksheet.
2) Name of the email message and workbooks to be attached will be dynamic (all the files will be saved in same folder of macro file).

Please let me know if above task is possible using vba sooner
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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