View Single Post
 
Old 10-20-2014, 06:18 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Quote:
Originally Posted by megatronixs View Post
Is the below code counting from the top of the email box? (so 6 would be the inbox)?
No!
6 is the numeric equivalent of the default inbox.

You can access any of the folders from VBA e.g. to get the Inbox folder for a separate Account called 'Account Name'

Code:
Dim oFolder As Folder
Dim oFldr As Folder
Dim olNS As NameSpace
    Set olNS = Application.GetNamespace("Mapi")
    For Each oFolder In olNS.folders
        'MsgBox oFolder.Name
        If oFolder.Name = "AccountName" Then
            Set oFldr = oFolder.folders("Inbox")
        End If
    Next oFolder
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote