Outlook 2013 Macro

Outlook Discussion in 'Microsoft Office' started by Nicole C, Jan 27, 2016.

  1. Nicole C

    Nicole C

    Joined:
    Jan 27, 2016
    Likes Received:
    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.
     
    Nicole C, Jan 27, 2016
    #1
    1. Advertisements

  2. Nicole C

    Ian Administrator

    Joined:
    Feb 23, 2002
    Likes Received:
    828
    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
     
    Ian, Jan 29, 2016
    #2
    1. Advertisements

  3. Nicole C

    Nicole C

    Joined:
    Jan 27, 2016
    Likes Received:
    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
     
    Nicole C, Feb 4, 2016
    #3
  4. Nicole C

    Ian Administrator

    Joined:
    Feb 23, 2002
    Likes Received:
    828
    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.
     
    Ian, Feb 6, 2016
    #4
  5. Nicole C

    JohnBgoode

    Joined:
    Jul 7, 2018
    Likes Received:
    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.
     
    JohnBgoode, Jul 8, 2018
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.