VBA code to mail to multiple recipients/multiple attachments through Excel

Fillonte

Board Regular
Joined
May 29, 2015
Messages
73
Hi guys,

I have a macro to convert a sheet of my wb into pdf and email it. As long as it's one single sheet and one recipient for the mail, everything works great.

However I can't seem to be able to have the macro:

1) mail the file to multiple recipients;

2) attach to the email more than one file;

Is there a way to do it?

This is the code I'm using for the sending part of the macro

Code:
 MailFromMacWithMail bodycontent:="" & vbNewLine & vbNewLine & "", _
                            mailsubject:="", _
                            toaddress:="", _
                            ccaddress:="", _
                            bccaddress:="", _
                            attachment:=PDFfolder & PDFfileName & ".pdf", _
                            displaymail:=False

I can't manage to add more addresses or attachments no matter what I do (I have no background into coding whatsoever though).

I'm on a Mac using Mail, but if there's no other solution, I could try Outlook (even though I kinda hate it).

Thanks in advance for any help
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Fillonte

Board Regular
Joined
May 29, 2015
Messages
73
I've tried to add

Code:
 Dim myaddress
myaddress = Array("address1@gmail.com", "address2@gmail.com")

and use "myaddress" in "toaddress" line of the mailing code, but I end up getting a"Byref argument type mismatch error".

I'm definitely lost on this.
 

Fillonte

Board Regular
Joined
May 29, 2015
Messages
73
Anyone with any insight on the issue today?

I'm still totally stuck here and I really need to finish this project.

Thanks in advance
 

Watch MrExcel Video

Forum statistics

Threads
1,123,336
Messages
5,601,023
Members
414,421
Latest member
tonybear1994

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top