Results 1 to 7 of 7
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Amount of control of outlook


    Is it possible to use VBA to control outlook to do things like look through a specific inbox folder and parse certain emails for say... email addresses and so on?

  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,530
    I do it a lot for automated imports of data, though I've always used the subject. This got me started:

    http://www.thatlldoit.com/Pages/howtosarticles.aspx

    Specifically the "Saving an Email Attachment" section.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by pbaldy View Post
    I do it a lot for automated imports of data, though I've always used the subject. This got me started:

    http://www.thatlldoit.com/Pages/howtosarticles.aspx

    Specifically the "Saving an Email Attachment" section.
    Great that looks like it will search through subjects in an email and more so I can look for specific matching strings - this will make it possible to do what I want.

    Any code I make I will post.

    I'm thinking of putting the code on my website down the track so that it is organised just like the website you posted.

    Thanks pbaldy

  4. #4
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I do have another question however

    I notice code online that uses ActiveExplorer()

    I also noticed that the default folder inbox = 6 in the code but how would you refer to a custom made folder?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Where that code has outItem.Subject my guess is you might be able to test outItem.From for an email address, but that's total speculation.

    I typically move emails to a subfolder of the inbox when I finish the import, and this is how I set that:

    Set outTargetFolder = outFolder.Folders.Item("TravelocityTransactions")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by pbaldy View Post
    Where that code has outItem.Subject my guess is you might be able to test outItem.From for an email address, but that's total speculation.

    I typically move emails to a subfolder of the inbox when I finish the import, and this is how I set that:

    Set outTargetFolder = outFolder.Folders.Item("TravelocityTransactions")
    I'm new to this so I'm not sure what I am doing wrong


    Currently I have

    Code:
    
    Function getOutlookBounceBack(outSubject As String)
    
    
    Dim objOL As Outlook.Application          'Outlook.Application
    Dim outFolder As Object         'Outlook.Folder
    Dim outNameSpace As Object      'Outlook.NameSpace
    Dim objEmail As Outlook.MailItem
    Dim objSelection As Outlook.Selection
    
    
    outSubject = UCase(outSubject)
    Set objOLApp = CreateObject("Outlook.Application")
    Set outNameSpace = objOLApp.GetNamespace("MAPI")
    
    
    
    
    
    
    
    
    
    
    For Each objEmail In objSelection
    If objSelection.Subject = outSubject Then
    Debug.Print objSelection.Subject
    End If
    Next
    
    
    
    
    
    
    
    
    End Function
    of course objEmail is null as I haven't selected anything or it where the selection is. Preferably I'd like it to find the specific folder and loop through all the emails in the folder...

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    You didn't set outFolder, and you completely made up this line:

    For Each objEmail In objSelection

    which should be using outFolder. Also make sure you compare apples to apples case-wise.
    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. Replies: 12
    Last Post: 07-18-2014, 01:22 PM
  2. Replies: 11
    Last Post: 05-20-2014, 11:32 AM
  3. =Sum with a max amount
    By spacekowboy in forum Reports
    Replies: 4
    Last Post: 05-15-2014, 07:32 AM
  4. Replies: 6
    Last Post: 11-18-2013, 04:50 PM
  5. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 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