I am trying to write an automation that will delete the deleted files in the deleted items folder in outlook.....

Here is the code.

Private Sub Command1_Click()
Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objInbox As MAPIFolder
Dim objMail As MailItem

'Get the MAPI reference
Set objNameSpace = objOutlook.GetNamespace("MAPI")

'Pick up the Inbox
Set objInbox = objNameSpace.GetDefaultFolder(olFolderDeletedItems)

'Loop through the folders under the Inbox
For Each objMail In objInbox.Items
objMail.Delete
Next objMail

End Sub

I get a code error when it gets to a certain part in the folder....

Type mismatch - error 13