Results 1 to 2 of 2
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,367

    Outlook.MAPI Folder

    Hi Guy's , i am trying to open an email inbox from a command button, how do i open a specific inbox and refresh a list and i don't have reference to MAPi folder, unsure what reference Library this is in ?



    I copied this code and pasted to a command button on click

    I have x 7 inbox folders but i want to open a specific folder, lets call the inbox i want to open work@ any ideas

    Much appreciated

    Code:
    Const olFolderInbox = 6
    Dim OlApp As Outlook.Application
    Dim Inbox As Outlook.MAPIFolder
    Dim InboxItems As Outlook.Items
    Dim Mailobject As Object
    
    
    Set OlApp = CreateObject("Outlook.Application")
    Set Inbox = OlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
    Set InboxItems = Inbox.Items
    For Each Mailobject In InboxItems
        End If
    Next
    
    
    Me.lstEmails.Requery
    
    
    Error_Handler_Exit:
        'cleanup ->
        Set OlApp = Nothing
        Set Inbox = Nothing
        Set InboxItems = Nothing
        Set Mailobject = Nothing
        Exit Sub
    Error_Handler:
            MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
               "Error Number: " & Err.Number & vbCrLf & _
               "Error Source: ReadInbox" & vbCrLf & _
               "Error Description: " & Err.Description, _
               vbExclamation, "An Error has Occurred!"
        Resume Error_Handler_Exit

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    From an app where I'm designating a target folder to move items to (it's a subfolder of the inbox):

    Code:
        Set objOLApp = CreateObject("Outlook.application")
        Set outNameSpace = objOLApp.GetNamespace("MAPI")
        Set outFolder = outNameSpace.GetDefaultFolder(6)
    
        Set outTargetFolder = outFolder.folders.Item("LoomisTransactions")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Outlook Folder - No List to Import
    By face in forum Import/Export Data
    Replies: 1
    Last Post: 09-04-2014, 01:49 PM
  2. import outlook folder
    By ck4794 in forum Import/Export Data
    Replies: 1
    Last Post: 06-04-2014, 08:11 AM
  3. Import Outlook folder
    By jjitss in forum Import/Export Data
    Replies: 1
    Last Post: 05-07-2014, 11:20 AM
  4. creating folder from Ms access in outlook
    By capitala in forum Programming
    Replies: 5
    Last Post: 03-08-2013, 10:05 PM
  5. Move to specified Outlook folder
    By starson79 in forum Programming
    Replies: 2
    Last Post: 08-15-2011, 03:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums