Consulting

Results 1 to 4 of 4

Thread: Edit VBA to mark original email as read in Outlook 2010

  1. #1
    VBAX Newbie
    Joined
    May 2018
    Posts
    2
    Location

    Edit VBA to mark original email as read in Outlook 2010

    Hi,
    i recently created some VBA's to either 'Reply All' or to or 'Forward' emails and adding the word "Restricted" at the beginning of the subject. the VBA work OK for that, however it is marking the mail as read in the viewing pane but not the inbox number of unread emails? could someone help me with the below VBA's to adjust this? I have attached an example of how i want it to look.

    VBA 1 for Replying all to emails

    Public Sub SecureReply()
    Dim objApp As Outlook.Application
    Dim objItem As MailItem
    Dim strSecure As String


    Set objApp = Application
    Set objItem = objApp.ActiveExplorer.Selection.Item(1)
    Set Item = objItem.ReplyAll

    strSecure = "RESTRICTED " & Item.Subject
    Item.Subject = strSecure
    Item.Display
    End Sub

    VBA 2 for Forwarding emails

    Public Sub SecureForward()
    Dim objApp As Outlook.Application
    Dim objItem As MailItem
    Dim strSecure As String


    Set objApp = Application
    Set objItem = objApp.ActiveExplorer.Selection.Item(1)
    Set Item = objItem.Forward

    strSecure = "RESTRICTED " & Item.Subject
    Item.Subject = strSecure
    Item.Display
    End Sub


    Many thanks in advance for anyones help!
    Attached Files Attached Files

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    objItem.unread = false
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    Site glitch? Answer to another question posted in wrong thread.
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  4. #4
    VBAX Newbie
    Joined
    May 2018
    Posts
    2
    Location
    Amazing, thanks so much. I spent ages looking online for an additional code. Very much appreciated

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •