I'm trying to move all my junk mail to my inbox by VBA code. Unfortunately i get an '424 object required' error on this line:
Item.Move (olFLD)
The code works when i try to move mail from inbox to another folder but it doesn't work the other way around when i try to move a mail from junk to the inbox.
Dim OlNS As Outlook.NameSpace
Dim olFLD As Outlook.Folder
Dim olJunk As Outlook.Folder
Sub Junk()
Set OlNS = Outlook.GetNamespace("MAPI")
Set olFLD = OlNS.GetDefaultFolder(olFolderInbox)
Set olJunk = OlNS.GetDefaultFolder(olFolderJunk)
While olJunk.Items.Count <> 0
For Each Item In olJunk.Items
Item.Move (olFLD)
Next
Wend
End Sub
Does anyone have an answer to my problem?
Thanks in advance.