PDA

View Full Version : RE: Insert/Embed outlook mail using vba Excel



Keerthi@21
06-20-2022, 08:00 AM
Hi Folks,


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

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


Addiontal task:
1) I would need to attach 3 more files 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 should be dynamic (all the files will be saved in same folder of macro file).


Could you please help whether the above steps are also possible to include in this code:


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







If the possibility is yes, Please help out with code!

macropod
06-21-2022, 12:33 AM
Please edit your post to enclose your code with the code tags used here. They can be inserted via the # symbol on the posting toolbar. When editing, you may need to access the Advanced toolbar.

Keerthi@21
06-21-2022, 01:18 AM
Hi Macropod,

As mentioned used the # symbol for the code. Please help me out based on the requirements which i mentioned in initial thread



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

Aussiebear
06-21-2022, 02:25 AM
@Keerthi@21. Try either highlighting your code then clicking on the hash tags "#" or click the "#' tag and write or post your code within them.

Keerthi@21
06-23-2022, 06:37 AM
I would need to perform additional task along existing steps which i have mentioned below for your reference:

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

Existing code of mine - Below code only insert email into worksheet as object.


sub Email()
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 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 should be dynamic (all the files will be saved in same folder of macro file).


Please help out

Keerthi@21
06-27-2022, 09:55 PM
Hi Folks,

Please help out! Awaiting response for the same.

Thanks in Advance!