Mark Email as Read at the end of a Macro

Felix_Dragonhammer

Board Regular
Joined
Apr 7, 2015
Messages
117
I have this code:
Code:
Sub Save_and_Open_Source1(itm As Outlook.MailItem)
    Dim ns As NameSpace
    Dim Inbox As MAPIFolder
    Dim SubFolder As MAPIFolder
    Dim item As Object
    Dim Atmt As Attachment
        Set Atmt = Nothing
    Dim File_Name As String
    Dim i As Integer
    Dim varResponse As VbMsgBoxResult
    Set ns = GetNamespace("MAPI")
    Set Inbox = ns.GetDefaultFolder(olFolderInbox)
    Set SubFolder = Inbox.Folders("IR GPAU Files")
    
    
    For Each Atmt In SubFolder.Items(SubFolder.Items.Count).Attachments
'Check filename of each attachment and save if it has "xls" extension
            If Right(Atmt.FileName, 4) = "xlsx" Then
            'This path must exist! Change folder name as necessary.
    
    Set FileName = Nothing
    
    File_Name = "C:\Users\sberger\Desktop\GPAU\" & Atmt.FileName
    Atmt.SaveAsFile File_Name
    
    Dim xlApp As Object
    Dim sourceWB As Object
    
    Set xlApp = GetObject(, "Excel.Application")
    With xlApp
        .Visible = True
        .EnableEvents = False
    End With
    Set sourceWB = xlApp.Workbooks.Open(File_Name, , False, , , , , , , True)
            End If
        Next Atmt
    
    
        
    Call Check
    
    
    
 
    
End Sub

Basically I was wondering how I would mark the email the code references as read after it's done with everything else it does.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,226,112
Messages
6,189,031
Members
453,520
Latest member
packrat68

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top