Neat reply, thanks!
Except i'm still getting the same behaviour.
Code:
Set olFolder = olStore.GetDefaultFolder(olFolderInbox).folders("Suppliers")
I can tell when it's going to fail, as
Code:
olStore.GetDefaultFolder(olFolderInbox).folders.count
will return 0.
Quote:
Originally Posted by gmayor
Assuming the account name is Office then
Code:
Sub MoveSelectedMsg()
Dim olStore As Store
Dim olFolder As Folder
Dim olItem As MailItem
On Error Resume Next
Select Case Outlook.Application.ActiveWindow.Class
Case olInspector
Set olItem = ActiveInspector.currentItem
Case olExplorer
Set olItem = Application.ActiveExplorer.Selection.Item(1)
End Select
For Each olStore In Session.Stores
If olStore = "Office" Then
Set olFolder = olStore.GetDefaultFolder(olFolderInbox).folders("Suppliers")
olItem.Move olFolder
Exit For
End If
Next olStore
Set olStore = Nothing
Set olFolder = Nothing
Set olItem = Nothing
End Sub
|