Click to See Complete Forum and Search --> : Newbie needs advice on VB/Outlook
Chris Bryce
September 20th, 2001, 06:45 AM
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>
Chris Bryce
September 20th, 2001, 06:51 AM
Ah markup<>HTML
Chris Bryce
http://www.wavefold.co.uk
Cakkie
September 20th, 2001, 08:48 AM
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
slisse@planetinternet.be
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
Chris Bryce
September 21st, 2001, 06:07 AM
Thank you tbis was perfect for what I needed.
Chris Bryce
http://www.wavefold.co.uk
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.