Forum Discussion

shetzel's avatar
shetzel
Brass Contributor
Sep 12, 2024
Solved

Add recipients and email workbook in a macro

I have a macro and it pulls up Outlook with the attached workbook and then I have to fill in the recipient, but would like the macro to do that for me. I have searched the code but have not been able to get it to work. Any help would be greatly appreciated. Thanks

  • shetzel In your code there is this line:

     

    Application.Dialogs(xlDialogSendMail).Show

     

    What is not widely known is that the Show method accepts arguments. The first argument is the "To" email address. So if you change that code to this:

     

    Application.Dialogs(xlDialogSendMail).Show "email address removed for privacy reasons"

     

    the To address wil be prefilled with "email address removed for privacy reasons. ". In addition, the second argument is the subject line.

4 Replies

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    shetzel In your code there is this line:

     

    Application.Dialogs(xlDialogSendMail).Show

     

    What is not widely known is that the Show method accepts arguments. The first argument is the "To" email address. So if you change that code to this:

     

    Application.Dialogs(xlDialogSendMail).Show "email address removed for privacy reasons"

     

    the To address wil be prefilled with "email address removed for privacy reasons. ". In addition, the second argument is the subject line.