ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use a variable with Sendmail ? (https://www.excelbanter.com/excel-programming/273248-re-use-variable-sendmail.html)

Ron de Bruin

Use a variable with Sendmail ?
 
Private Sub ComboBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveWorkbook.SendMail ComboBox1.Value
End Sub

with a combobox from the control toolbox you can use this.
When you double click on the combobox after you choose the address it
will send the mail

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Joe 90" wrote in message ...
Have been working up an app and need to send emails from it.

Using Sendmail I can happily email colleagues if I use the prescribed
syntax:

Activeworkbook.Sendmail "Joe 90" (with Joe 90 being a valid name)

However I want to chose a name from a list in a combobox, place that name in
a variable and use that variable to send the email with:

dim name

name = Combobox1.Value (have left out the rest of the defining info, e.g.
workbook,worksheet etc)

Activeworkbook.Sendmail name

This doesn't work (even though I make sure all the inverted commas are there
in the name variable)

Is there a way to do this?

Cheers

Joe 90





Joe 90

Use a variable with Sendmail ?
 
Ron

Many thanks. Of course, that was the one thing I didn't try (and should
have), which was simply using the full reference e.g. ComboBox1.value to
replace the valid name. it's oh so simple now you tell me!

Thanks again

Joe 90

"Ron de Bruin" wrote in message
...
Private Sub ComboBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveWorkbook.SendMail ComboBox1.Value
End Sub

with a combobox from the control toolbox you can use this.
When you double click on the combobox after you choose the address it
will send the mail

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Joe 90" wrote in message

...
Have been working up an app and need to send emails from it.

Using Sendmail I can happily email colleagues if I use the prescribed
syntax:

Activeworkbook.Sendmail "Joe 90" (with Joe 90 being a valid name)

However I want to chose a name from a list in a combobox, place that

name in
a variable and use that variable to send the email with:

dim name

name = Combobox1.Value (have left out the rest of the defining info,

e.g.
workbook,worksheet etc)

Activeworkbook.Sendmail name

This doesn't work (even though I make sure all the inverted commas are

there
in the name variable)

Is there a way to do this?

Cheers

Joe 90








All times are GMT +1. The time now is 03:56 PM.

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