CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    3

    Newbie needs advice on VB/Outlook

    Complete newbie to VB.

    I need to use VB6 to open Outlook 97 Inbox, search for an unread mail from a specific person, save two attachments therein and then perhaps delete the mail.

    Haven't a cluie where to start:-) and any help woiuld be much appreciated.

    Thanks

    <b>Chris Bryce</b> <a href="http://www.wavefold.co.uk">www.wavefild.co.uk</a>

  2. #2
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    3

    Re: Newbie needs advice on VB/Outlook

    Ah markup<>HTML

    Chris Bryce
    http://www.wavefold.co.uk

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Newbie needs advice on VB/Outlook

    Here's the code. What it does is run through all the messages in your inbox, if the sender is a specific person, check for attachments and save them to your hd

    private Sub Command1_Click()

    Dim OLApp as new Outlook.Application
    Dim OLNS as Outlook.NameSpace
    Dim OLFL as Outlook.MAPIFolder
    Dim OLMI as Outlook.MailItem
    Dim OLAT as Outlook.Attachment

    set OLNS = OLApp.GetNamespace("MAPI")
    set OLFL = OLNS.GetDefaultFolder(olFolderInbox)

    for Each OLMI In OLFL.Items
    If OLMI.SenderName = "Cakkie" then
    for Each OLAT In OLMI.Attachments
    OLAT.SaveAsFile "c:\" & OLAT.FileName
    next OLAT
    End If
    next OLMI

    End Sub




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  4. #4
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    3

    Re: Newbie needs advice on VB/Outlook

    Thank you tbis was perfect for what I needed.



    Chris Bryce
    http://www.wavefold.co.uk

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured