Posted to microsoft.public.excel.programming
|
|
"Send Email" macro to multiple addresses
You are welcome
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"LKP" wrote in message ...
Ron-
You are a genius! Thank you so much. It works perfectly.
"Ron de Bruin" wrote:
Try this
With wb2
On Error Resume Next
If LCase(Range("A1").Value) = "exceeds a threshold" Then
.SendMail ", "), _
"This is the Subject line"
Else
.SendMail ", "), _
"This is the Subject line"
End If
On Error GoTo 0
.Close SaveChanges:=False
End With
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"LKP" wrote in message ...
Great, Ron. I think that will work. The variable I am looking for is if a
cell says "Exceeds a Threshold". How would I put this into the code? Also,
if I need to send to multiple addresses, can I use the array feature you
showed me earlier?
Thanks
"Ron de Bruin" wrote:
You can use code like this in the macro to test a cell value
Dim ToStr As String
If LCase(Range("A1").Value) = "yes" Then
ToStr = "
Else
ToStr = "
End If
With wb2
On Error Resume Next
.SendMail ToStr, _
"Product"
On Error GoTo 0
.Close SaveChanges:=False
End With
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"LKP" wrote in message ...
Thanks, Ron. Do you know how I can make a mcaro button conditional? I want
this "Send Email" button to one person if certain conditions are met and
another person if these conditions are not met.
"Ron de Bruin" wrote:
Oops
Also, when I click on this button, a security warning pops up asking if I
want to enable the macros, which I do. How do I turn that pop up off?
You can change the security
Use the shortcut to go to that dialog
Alt tms
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"LKP" wrote in message ...
Sweet! Thanks Ron!
"Ron de Bruin" wrote:
Hi LKP
See
http://www.rondebruin.nl/mail/tips1.htm
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"LKP" wrote in message ...
I am trying to get a send email button to send emails to multiple addresses.
I can get it to work for one address, but I don't know how to do multiples.
Here's the code:
wb1.SaveCopyAs TempFilePath & TempFileName & FileExtStr
Set wb2 = Workbooks.Open(TempFilePath & TempFileName & FileExtStr)
With wb2
On Error Resume Next
.SendMail ", _
"Product"
On Error GoTo 0
.Close SaveChanges:=False
End With
'Delete the file
Kill TempFilePath & TempFileName & FileExtStr
With Application
.ScreenUpdating = True
.EnableEvents = True
Can anyone help?
Also, when I click on this button, a security warning pops up asking if I
want to enable the macros, which I do. How do I turn that pop up off?
|