J
Joe
Hi. This seems pretty basic, but I've been racking my brains.
I'm using VBA in Outlook 2003.
I want to move an email from the Inbox folder to a sub-folder.
I get Run-time error '424' - Object Required when the Move method is
executed on the email.
The email and folders exist and are the ones I want at the time of the Move.
I see them in the Locals window.
It does make it to the Move, so the objects look right to me.
Thanks for you help.
Here's the code:
Sub MoveEmail()
Dim fdrInbox As Outlook.MAPIFolder
Dim fdrDone As Outlook.MAPIFolder
Dim itmEmail As Outlook.MailItem
Set fdrInbox =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set fdrDone = fdrInbox.Folders.Item("Done")
Set itmEmail = fdrInbox.Items.Item(1)
If TypeName(itmEmail) = "MailItem" Then
If TypeName(fdrDone) = "MAPIFolder" Then
itmEmail.Move (fdrDone)
End If
End If
End Sub
I'm using VBA in Outlook 2003.
I want to move an email from the Inbox folder to a sub-folder.
I get Run-time error '424' - Object Required when the Move method is
executed on the email.
The email and folders exist and are the ones I want at the time of the Move.
I see them in the Locals window.
It does make it to the Move, so the objects look right to me.
Thanks for you help.
Here's the code:
Sub MoveEmail()
Dim fdrInbox As Outlook.MAPIFolder
Dim fdrDone As Outlook.MAPIFolder
Dim itmEmail As Outlook.MailItem
Set fdrInbox =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set fdrDone = fdrInbox.Folders.Item("Done")
Set itmEmail = fdrInbox.Items.Item(1)
If TypeName(itmEmail) = "MailItem" Then
If TypeName(fdrDone) = "MAPIFolder" Then
itmEmail.Move (fdrDone)
End If
End If
End Sub