ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sending an email (https://www.excelbanter.com/excel-programming/313530-sending-email.html)

Jamie

Sending an email
 
Hi There

I have the following code to send an email when a button is clicked:

Sub Mail_workbook_1()
ActiveWorkbook.SendMail ", _
"EIS - Feeback Form"
ActiveWorkbook.Close False

End Sub

I would like to be able to change the address that the email is sent to
based on a cell value.

At the moment I have an if statement in Q4 that says
",if(a1="MrB","MrB@C ompanyB.com")

so basically if Mr A is selected in A1 when the macro runs it will send th
eemail to Mr A's address and if Mr B is in A1 then it will send to Mr B's
address.

Any help on this would be greatly appreciated.

Thanks in advance

Jamie




Frank Kabel

Sending an email
 
Hi
Sub Mail_workbook_1()
ActiveWorkbook.SendMail activesheet.range("Q4").value, _
"EIS - Feeback Form"
ActiveWorkbook.Close False

End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


Jamie wrote:
Hi There

I have the following code to send an email when a button is clicked:

Sub Mail_workbook_1()
ActiveWorkbook.SendMail ", _
"EIS - Feeback Form"
ActiveWorkbook.Close False

End Sub

I would like to be able to change the address that the email is sent
to based on a cell value.

At the moment I have an if statement in Q4 that says
",if(a1="MrB","MrB@C ompanyB.com")

so basically if Mr A is selected in A1 when the macro runs it will
send th eemail to Mr A's address and if Mr B is in A1 then it will
send to Mr B's address.

Any help on this would be greatly appreciated.

Thanks in advance

Jamie


Frank Stone

Sending an email
 
hi,
see this site
http://www.rondebruin.nl/sendmail.htm
reguards
Frank
-----Original Message-----
Hi There

I have the following code to send an email when a button

is clicked:

Sub Mail_workbook_1()
ActiveWorkbook.SendMail ", _
"EIS - Feeback Form"
ActiveWorkbook.Close False

End Sub

I would like to be able to change the address that the

email is sent to
based on a cell value.

At the moment I have an if statement in Q4 that says
",if

")

so basically if Mr A is selected in A1 when the macro

runs it will send th
eemail to Mr A's address and if Mr B is in A1 then it

will send to Mr B's
address.

Any help on this would be greatly appreciated.

Thanks in advance

Jamie



.



All times are GMT +1. The time now is 09:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com