1 Attachment(s)
Script to auto-click "Allow" Outlook promt
I am trying to automate the sending of an email through VB Script, but am receiving this message:
http://www.vbforums.com/attachment.p...1&d=1329764207
I can get the script to activate the window via:
Code:
Set objShell = WScript.CreateObject("WScript.Shell")
Do Until Success = True
Success = objShell.AppActivate("Microsoft Office Outlook")
Loop
I need a piece of code that will automatically click this "Allow" button. I can't really use sendkeys because this will be running while my PC is locked. My employer has my outlook locked down, so adjusting settings isn't an option. Any help would be great.
Re: Script to auto-click "Allow" Outlook promt
Hi :wave: Try using CDO like this example :
PHP Code:
Dim messageHTML
Dim Previousday
Dim FileAttach
Dim ToAddress
Dim CcAddress
Dim MailSubject
Previousday = Day(Date-1) & "_" & Month(Date-1) & "_" & Year(Date-1)
messageHTML="Find in attachment, Report Day_" & (Previousday)
'FileAttach = "D:\Report_Day_" & (Previousday) & ".xlsx"
FromAddress = "[email protected]"
ToAddress = "[email protected]"
'CcAddress = "[email protected]"
MailSubject = "Report_Day_" & (Previousday)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = MailSubject
objMessage.From = FromAddress
objMessage.To = ToAddress
'objMessage.CC = CcAddress
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.xxxx.com" 'change THE SMTP SERVER to yours
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'Ajout d'un message en HTML
objMessage.HTMLBody="<center><font size=4 FACE=Tahoma Color=red>"&messageHTML
'objMessage.AddAttachment(FileAttach)
objMessage.Send
If Err.Number <>0 Then
MsgBox Err.Description,16,"Erreur"
msgbox "The mail failed to delivery !",16,"Information"
Else
msgbox "The mail sent sucessfully !",64,"Information"
End If
Re: Script to auto-click "Allow" Outlook promt
Thanks for the reply. I've looked into doing it that way, but I would like to bypass that by simply creating a script to detect that pop message and click allow for me. I'm just havin a hard time finding the code to do that.