View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Annoying "virus" alert when using code to send mail

I am getting an alert when using the below code to send mail from Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose "No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ", _
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb