Can anyone tell me why the following code won't work?
Sub AddToJunkAndMove(objSel As Selection)
Dim objItem As Object
Dim objNS As NameSpace
Dim objDestFolder As MAPIFolder
Dim myOlApp As Outlook.Application
Set objNS = Application.GetNamespace("MAPI")
Set objDestFolder = objNS.Folders.Item("Mailbox - AAAAA, BBBBB").Folders.Item("Junk mail")
it always fails at the last line saying object could not be found. Yet the Mailbox and folder are correct
Sub AddToJunkAndMove(objSel As Selection)
Dim objItem As Object
Dim objNS As NameSpace
Dim objDestFolder As MAPIFolder
Dim myOlApp As Outlook.Application
Set objNS = Application.GetNamespace("MAPI")
Set objDestFolder = objNS.Folders.Item("Mailbox - AAAAA, BBBBB").Folders.Item("Junk mail")
it always fails at the last line saying object could not be found. Yet the Mailbox and folder are correct