Consulting

Results 1 to 6 of 6

Thread: RE: Insert/Embed outlook mail using vba Excel

  1. #1

    RE: Insert/Embed outlook mail using vba Excel

    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!
    Last edited by Aussiebear; 06-21-2022 at 02:23 AM. Reason: added correct code tags for submitted code

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    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.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3

    RE: Insert/Embed outlook mail using vba Excel

    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

  4. #4
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,997
    Location
    @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.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    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
    Last edited by Aussiebear; 06-26-2022 at 02:01 PM. Reason: Remove additional Code tags

  6. #6
    Hi Folks,

    Please help out! Awaiting response for the same.

    Thanks in Advance!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •