Question : Macro for delay send of an excel sheet to a mail recipient

Hello Experts,

I have a button on the active excel sheet assigned to the following macro:
Sub TestTimer()
Dim timenow As Double
Dim MinuteDelay As Long
MinuteDelay = CLng(InputBox("Enter how many minutes you want to delay before sending turnover:"))
MinuteDelay = MinuteDelay * 60
MsgBox "Click OK to Start Delay Send Timer"
timenow = Timer
Do Until Timer >= (timenow + MinuteDelay)
   
Loop
ActiveWorkbook.SendMail Recipients:="[email protected]ne.com"
MsgBox "Message Sent"
End Sub

It almost works - unfortunately I get an "Microsoft Office Outlook" warning "A program is trying to automatically send e-mail on your behalf" "Do you want to allow this?" this requires you to select yes before the email is sent; therefore thwarting the automatic delay send function.

Is there another way around this?

Thanks for your help.
 

Answer : Macro for delay send of an excel sheet to a mail recipient

The outlook warning is a security feature but one you can work around,

I would suggest at first pass the use of a DLL in outlook namely the mapilab add-in.  I use this routinely and it is free for both private and commercial usage, (or was the last time I checked).  Basically the first time you do something in code it pops up a box asking if you want to allow the action and if you select 'always do this' then it is transparent from that point.  i.e. install it, do the action and it will

http://www.mapilab.com/outlook/security

Chris
Random Solutions  
 
programming4us programming4us