View Single Post
 
Old 09-17-2020, 11:12 PM
travb81 travb81 is offline Windows 10 Office 2016
Novice
 
Join Date: Aug 2017
Posts: 11
travb81 is on a distinguished road
Default

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 View Post
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
Reply With Quote