Macro to Send Excel Table Inside an Email

%3CLINGO-SUB%20id%3D%22lingo-sub-2424172%22%20slang%3D%22en-US%22%3EMacro%20to%20Send%20Excel%20Table%20Inside%20an%20Email%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2424172%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20a%20way%20to%20get%20the%20macro%20recorder%20to%20record%20%22Send%20to%20Mail%20Recipient%22%20function%20with%20%22send%20the%20current%20sheet%20as%20message%20body%22%20option%3F%20I'm%20really%20trying%20to%20get%20the%20VBA%20code%20that%20converts%20the%20sheet%20to%20HTML%20format%20when%20I%20click%20%22Send%20to%20Mail%20Recipient%22.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20would%20like%20to%20automate%20sending%20an%20Excel%20table%20inside%20an%20Outlook%20email%20with%20matched%20formatting%20between%20the%20table%20in%20the%20email%20and%20the%20table%20in%20Excel.%20The%20%22Send%20to%20Mail%20Recipient%22%20function%20formats%20the%20email%20perfectly%2C%20but%20the%20macro%20recorder%20does%20not%20record%20this%20function%20when%20I%20try%20it.%20There%20are%20guides%20on%20sending%20emails%20in%20VBA%20code%2C%20but%20formatting%20the%20table%20seems%20like%20it%20would%20be%20very%20difficult%20to%20code%20especially%20since%20the%20table%20changes%20size.%20(I%20can't%20just%20use%20email%20source%20code%20for%20the%20HTML%20code).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2424172%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2425051%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20to%20Send%20Excel%20Table%20Inside%20an%20Email%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2425051%22%20slang%3D%22en-US%22%3E%3CP%3EI%20did%20some%20searching%20and%20this%20code%20actually%20worked%20really%20well.%20%3CA%20href%3D%22https%3A%2F%2Fwww.rondebruin.nl%2Fwin%2Fs1%2Foutlook%2Fbmail1.htm%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ELink%3C%2FA%3E.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20seems%20to%20open%20Outlook%20and%20do%20a%20copy%20and%20paste%20including%20formatting.%20Table%20size%20is%20obtained%20to%20account%20for%20changes%20in%20size.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1073242%22%20target%3D%22_blank%22%3E%40worker565%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Is there a way to get the macro recorder to record "Send to Mail Recipient" function with "send the current sheet as message body" option? I'm really trying to get the VBA code that converts the sheet to HTML format when I click "Send to Mail Recipient".

I would like to automate sending an Excel table inside an Outlook email with matched formatting between the table in the email and the table in Excel. The "Send to Mail Recipient" function formats the email perfectly, but the macro recorder does not record this function when I try it. There are guides on sending emails in VBA code, but formatting the table seems like it would be very difficult to code especially since the table changes size. (I can't just use email source code for the HTML code).

1 Reply

I did some searching and this code actually worked really well. Link

It seems to open Outlook and do a copy and paste including formatting. Table size is obtained to account for changes in size.

Thanks.

@worker565