Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8

    Unanswered: Could be Wrong Place Help!!

    I can read my outlook inbox

    by this Code

    Code:
    Dim ol As Outlook.Application
    Dim olns As NameSpace
    Dim myFolder As MAPIFolder
    Dim MyItems As Object
    Dim objRecip As Outlook.Recipient
    Dim objReply As MailItem
    Dim objRecips As Outlook.Recipients
    Dim item As Variant
    Dim i As Long
    Dim rst As Recordset
    Dim db As Database
       
       Set db = CurrentDb
       Set rst = db.OpenRecordset("EmailName")
       Set ol = New Outlook.Application
       Set olns = ol.GetNamespace("MAPI")
       Set myFolder = olns.GetDefaultFolder(olFolderInbox)
       
    For i = myFolder.Items.Count To 1 Step -1
     Set objReply = myFolder.Items.item(i).Reply
            Set objRecips = objReply.Recipients
            For Each objRecip In objRecips
            'MsgBox objRecip.Address
            Dim check As Long
            check = DCount("*", "EmailName", "EmailName = '" & objRecip.Address & "'")
            If check = 0 And Trim(objRecip.Address) <> "" Then
                rst.AddNew
                rst!EmailName = objRecip.Address
                rst!SenderName = myFolder.Items.item(i).SenderName
                rst.Update
                Beep
            End If
            
            Next
    
    Next
    to update a table

    have just cut paste to get it working.

    but i need it to read all my email folders as wife has been move my email to other folder ( thank her)

    can someone fill in the missing bits thanks
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    I don't have any experience with this, but here is my best guess as to how you may be able to figure it out.

    If you need it to read a folder other than the inbox, it is the

    Set myFolder = olns.GetDefaultFolder(olFolderInbox)

    line that would have to be altered. When running the code, what value does olFolderInbox have? What happens when you add 1 to that value? Does it access a different folder? If so, try more numbers until you get an error or the folder you need.

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    Thanks been there tride that

    From what i under stand

    the Set myFolder = olns.GetDefaultFolder(olFolderInbox)

    Set myFolder to the Default in inbox

    the other ones are cal olFolderContacts , olFolderTasks and so on

    but what are the other inbox folders call
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    No, but put a stop in the program and point to olFolderInbox. What comes up in the control tip? or put "? olFolderInbox" without the quotes into the debug/Immediate box and press enter. What is it's value? Try other values until you get an error.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •