Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Getting data from an email (XP)

    Hi guys,
    Can anyone help me with a way to get data from emails in a particular outlook folder into access?

    In particular I am after the sender's address and the To address. Maybe even the subject.

    Once I have the data it should remove the email from that directory.

    Thanks
    PS - I already tried Helen Feddema's web site.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Getting data from an email (XP)

    The attached text file contains sample code. It writes information about e-mails to a table.

    Comments:
    1) You must set a reference in Tools | References in the Visual Basic Editor to the Microsoft DAO 3.6 Object Library (to work with a recordset) and to the Microsoft Outlook 10.0 Object Library (to work with Outlook, 10.0 is the version number for Outlook 2002 aka XP)
    2) You must already have created a table tblMail with text fields strFrom, strTo and strSubject of sufficient length.
    3) This code reads the Inbox, you can change the following line to use a different folder:

    Set oFldr = oNs.GetDefaultFolder(olFolderInbox)

    4) Important: Copy the e-mails in the folder to another folder before testing, or perform your tests on a copied folder - the code discards the mails without asking!
    5) You'll run into Outlook security, asking you to give permission over and over again. You'll find workarounds in <post:=488,173>post 488,173</post:>; the free utility ClickYes is the easiest one.
    Attached Files Attached Files

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Getting data from an email (XP)

    Thanks,yet again Hans,
    That what I need.
    I'm not quite sure about the folder renaming - if olFolderInbox is the inbox folder then how would I make this reference a sub folder - would it be -
    Set oFldr = oNs.GetDefaultFolder(olFolderInbox & "subfolderName")
    Thanks agaiin

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Getting data from an email (XP)

    olFolderInbox is a predefined constant, not a name.

    If it's a subfolder of the inbox, you'd use

    Set oFldr = oNs.GetDefaultFolder(olFolderInbox).Folders("Subfo lderName")

  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Getting data from an email (XP)

    Thanks Hans

Posting Permissions

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