N
Nathan Carroll
why in procedure below do not all of the email messages get moved form the
loop process
Private Sub Application_Startup()
Dim item As Object
Dim subfolder As MAPIFolder
Dim mi As MailItem
On Error Resume Next
CreateButton
Set inBoxItems =
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
For Each item In inBoxItems
If item.Class = olMail Then
Set mi = item
Set subfolder =
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
If subfolder Is Nothing Then
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders.Add (mi.SenderName)
Set subfolder =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
End If
mi.Move subfolder
End If
Next
End Sub
loop process
Private Sub Application_Startup()
Dim item As Object
Dim subfolder As MAPIFolder
Dim mi As MailItem
On Error Resume Next
CreateButton
Set inBoxItems =
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
For Each item In inBoxItems
If item.Class = olMail Then
Set mi = item
Set subfolder =
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
If subfolder Is Nothing Then
Me.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders.Add (mi.SenderName)
Set subfolder =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
End If
mi.Move subfolder
End If
Next
End Sub