Consulting

Results 1 to 1 of 1

Thread: Outlook.Live VBA To Email From Excel Sheet

  1. #1

    Outlook.Live VBA To Email From Excel Sheet

    I have a couple different "email from excel" VBA versions that I edited from Ron De Bruin and they work just fine with "regular" Outlook. I am now using the app based Outlook.live and this new "non Ron De Bruin" code gets stuck on the Set OutMail = OutApp.createItem(0)and it wants me to set up account with Outlook 2016.

    I really don't want to use "regular" Outlook anymore and would like to use the Outlook.live. Is there some easy code for this to grab Outlook.live? I also have a couple gmail and yahoo email accounts if that is easier.

    This is a recipe card on excel that it is going to grab and email. I got this off the internet and adjusted for my purposes, but I am stuck with the emailing part. Thanks in advance for any help.

    Sub Recipe_Email()
    With Recipes
        LastRow = (4 * (.Range("B13").Value - 1)) + 14 'Set Last Row (4 times the # of Steps) + 14
        PrintRng = .Range("G3:Q" & LastRow).Address
        .PageSetup.PrintArea = PrintRng 'Set Print Range
      FileName = ThisWorkbook.Path & "" & .Range("K3").Value & "_" & "Recipe.pdf"
        If Dir(FileName, vbDirectory) <> "" Then Kill (FileName) 'Delete file if exists
        .ExportAsFixedFormat xlTypePDF, FileName, , , False
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.createItem(0)
        
        With OutMail
            .To = ""
            .attachments.Add FileName
            .Subject = Recipes.Range("K3").Value & " " & "Recipe"
            .body = ""
            .display 'To send use .Send
        End With
            On Error GoTo 0
            Set OutMail = Nothing
    End With
    End Sub
    Thanks
    Mike
    Attached Files Attached Files
    Last edited by Aussiebear; 12-12-2021 at 01:36 AM. Reason: Added code tags to submitted code

Posting Permissions

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