Results 1 to 3 of 3

Thread: Deleting emails from subfolder

  1. #1

    Deleting emails from subfolder

    The below code will permanently delete email from the Deleted Items folder in Outlook 365. How do I modify this so that it will only permanently delete emails from a subfolder of the Deleted Items folder I have created which is called "Extra"? Thanks.

    Sub DeletedItems()

    Dim lCount As Long

    Dim lCtr As Long

    Dim lDelete As Long

    Dim oFolder As Folder

    Dim oItems As Items

    Set oFolder = Outlook.Session.Folders("").Folders("Deleted Items")

    Set oItems = oFolder.Items
    lCount = oItems.Count

    On Error Resume Next
    lDelete = InputBox("Enter number to delete:", , lCount)
    On Error GoTo 0
    If lDelete = 0 Then
    Exit Sub
    End If

    For lCtr = lDelete To 1 Step -1
    End Sub

  2. #2
    Set oFolder = Outlook.Session.Folders("").Folders("Deleted Items").Folders("Extra")
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes

  3. #3
    Thanks gmayor. That did it.

Posting Permissions

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