OK. Here is your code, but I have used different names to try to indicate what each collection really is:
The routine is expecting a collection of items in the folder; NOT the folder name itself. So instead of calling it with myItms.Parent, just use myItms.VB Code:
Sub LookThroughFolder(ItemsInFolder) ' ' Step through all items in the Folder ' For Each myitem In ItemsInFolder 'MsgBox "Looking at: " & myitem & ". In: " & myitem.Parent & " (" & thisFolder.Count & ")." If myitem.Class = "43" Then For Each Attachment In myitem.Attachments ' ' For any mail item (class 43) with an attachment, check its name ' MsgBox "FOUND IN: " & myitem.Parent & " (IN: " & myitem.Parent.Parent & ")" & ". SUBJECT = " & myitem & ". ATTACHMENT = " & Attachment Next End If Next End Sub Sub mylittletest() Dim MAPI As NameSpace Set MAPI = ThisOutlookSession.Application.GetNamespace("MAPI") Dim myitms As Items Set myitms = MAPI.GetDefaultFolder(olFolderInbox).Items MsgBox "Looking at: " & myitms.Parent & " (" & myitms.Count & " items)." 'THIS NEXT LINE HAS CHANGED LookThroughFolder (myitms) End Sub
If you want to change the routine to accept a folder name, then the first bit of the routine will need to include the statement (approximately):
ItemsInFolder = FolderName.Items




