PDA

View Full Version : Solved: Turning Off Email safety in VBA?



White_Nova
02-06-2008, 04:23 AM
Hi All

Im using the following code to email a workbook to a select group if recipients.
The problem is that when i run the macro Microsift pops up with a message saying the following:
"A Program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date.

For more information about e-mail safety and how you might be able to avoid getting this warning, click help"

Ive clicked on help but it opens the basic help with no suggestions.
Please help!!!!!!

Sub Email()


Dim vtPath$
Dim vtSource$
Dim vtTarget$



'' Set up the source path
vtPath = ThisWorkbook.Path & "\Stats\"

'' Set up the target and source names
vtSource = vtPath & ctDb & ".xls"
vtTarget = vtPath & Format(Now, "ddhhmmss") & ".xls"


Sheets("Agent Summary").Select
Sheets("Agent Summary").Copy
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A2").Select
Application.CutCopyMode = False

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:= _
vtTarget _
, FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False, AccessMode:=xlNoChange, ConflictResolution:=Yes


Application.DisplayAlerts = False
ActiveWorkbook.SendMail ActiveSheet.Range("A48:A62").Value


End Sub

Jan Karel Pieterse
02-06-2008, 11:37 AM
Check out www.rondebruin.nl (http://www.rondebruin.nl) for emailing options from Excel, including ways to handle security.

White_Nova
02-07-2008, 12:45 AM
That website is excellent, but doesnt solve my problem in any way...
1. im not using temporary files.
2. Im looking for a solution to just stop that error message from showing.
3. Microsofts website is no help.
4. Suggstions of changing the trust centre also dont work...

Anybody that can proide answers to this please....

Jan Karel Pieterse
02-07-2008, 02:01 AM
Look again:
http://www.rondebruin.nl/mail/prevent.htm

White_Nova
02-07-2008, 02:43 AM
I have, i even browsed the Outlook 2007 (great change)http://msdn2.microsoft.com/en-us/library/ms778202.aspx section and it didnt have the answer to taking away the security box. Im lost here, im trying to play with a bit of code from that website to see if i cant come up with something...

Jan Karel Pieterse
02-07-2008, 03:08 AM
So what Outlook version are you targetting with your code?
Did you try the redemption route? Works fine in my experience.

White_Nova
02-07-2008, 03:11 AM
Hi Jan

Funny that, i just downloaded redemption and it solves my problems...
you have been a great help...

Thanks
Nova