|
-
Jul 10th, 2006, 10:10 PM
#1
Thread Starter
New Member
get information from outlook to excel
How can I:
flag an e-mail using a rule in outlook
from excel look for those flags
when found copy the text of the e-mail into excel and process it
then change the flag to completed
look for the next flag
if none quit outlook
I've tried several samples of code and so far I can't seem to open outlook from excel.
Thanks
-
Jul 11th, 2006, 08:42 AM
#2
Re: get information from outlook to excel
the reading of the BODY of the email will cause a security popup that makes the user
allow it to interact with outlook....(im using outlook 2003)
just put this in a module in excel and add a reference to the outlook x.0 object library
VB Code:
Private Sub GetMail()
Dim OTL As New Outlook.Application
Dim MAPI As Outlook.Namespace
Dim INBOX As Outlook.MAPIFolder
Dim MAIL As Outlook.MailItem
Set MAPI = OTL.GetNamespace("MAPI")
Set INBOX = MAPI.GetDefaultFolder(olFolderInbox)
For Each MAIL In INBOX.Items
If MAIL.FlagIcon = olRedFlagIcon Then
Debug.Print MAIL.Subject 'this will work without causing security popup
Debug.Print MAIL.Body 'this WILL cause the security popup
End If
Next
Set MAIL = Nothing
Set INBOX = Nothing
Set Map = Nothing
Set OTL = Nothing
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 11th, 2006, 07:27 PM
#3
Re: get information from outlook to excel
You also need to add a reference to MS Outlook xx.0 Object Library from Excels Project > References menu item.
I also have many many Outlook code examples on the forums.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|