Dear folks,

I am receiving emails from a supplier on a daily basis containing an attachment for all new orders.
Those emails are sent using a self-signed certificate with a password.
This means: If I want to see the content of such an email, I need to double-click the mail in Outlook, enter the certificate password (in a "Windows Credentials" window popping up) and then it will show the email as usual.
What I do next is saving the attachment locally.

This process is quite annoying
I was wondering if this process could be automated using VBA. I was able to trigger a script using "run a script" rule for the relevant mails, but VBA does not do anything (and does not see the attachment, probably because it cannot open the mail). Is there a way to achieve that?

Public Sub saveAttachment(mailItem As Outlook.MailItem)

Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "D:\MailAttachments"
MsgBox ("Script is running...") 'This shows up

     For Each objAtt In mailItem.Attachments
           MsgBox ("Found an attachment") 'This does not show up
          objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
          Set objAtt = Nothing
End Sub