Outlook Outlook 2013 Macro

Joined
Jan 27, 2016
Messages
2
Reaction score
0
I've created a custom button in Outlook 2013 for our encrypted messages that adds "Encrypt" to the subject and then gets flagged by Barracuda to send to the portal. What I'd like it to also do is when I hit my "Encrypt Message" button to receive a pop up box asking the user if they are sure they want to encrypt this message. Any help is greatly appreciated.
 

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,873
Reaction score
1,499
Could you post the script you've got so far please? I'm not familiar with Outlook but perhaps someone else here is - from what I remember from macros you'll need to use something like this before your code, then link vbYes and vbNo to your actions:

Code:
MsgBox("Are you sure you wish to Encrypt this e-mail?", vbYesNo + vbExclamation + vbMsgBoxSetForeground)

Here's a bit more info:
https://support.office.com/en-us/article/MsgBox-Function-e23511c8-4157-4e09-93a6-ba9f1749f4c0
 
Joined
Jan 27, 2016
Messages
2
Reaction score
0
This is what I have so far and it does almost everything I need it to except its not appending "Encrypt" to the subject; its overwriting it. I want it to add "Encrypt" if Ive already written something in the subject.

Sub EncryptMessage()
Dim objMsg As Outlook.MailItem
Set objMsg = Outlook.ActiveInspector.CurrentItem
objMsg.Subject = objMsg.Subject & "[Encrypt]"
If objMsg.Subject = "[Encrypt]" Then
MsgBox "Only Send Encrypted If Email Contains HIPAA Information.", vbOKOnly, "HIPAA Security Check"
End If
End Sub
 

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,873
Reaction score
1,499
Unfortunately I don't think I'll be of much use, as I would have thought your code should have worked.

objMsg.Subject = objMsg.Subject & "[Encrypt]" is exactly how I would have thought to append the tag.

Hopefully someone else here will know why it doesn't work as expected.
 
Joined
Jul 7, 2018
Messages
9
Reaction score
1
Nicole, it does not overwrite it because what you wrote is not saved yet.
not sure if this works but if you do after
{Set objMsg = Outlook.ActiveInspector.CurrentItem}
objmsg.save
it will save your item and write the changes you wrote to the item in Outlook memory.
It could however be that the references to the item need to be destoryed first (set to nothing) before you can access the now changed item and it's changed subject.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top