[RESOLVED] Looking for help with an Outlook macro
Well actually I'm looking for someone to write it for me and explain how to implement it.
What I'd like it to do when I press Ctrl-P is
- Look in my Inbox for an email with "Results for PokerStars Tournament" in the title
- Mark it as read
- Move it to an existing Outlook folder named "Poker Stars Wins"
If it matters, I'm using Outlook 2002.
Re: Looking for help with an Outlook macro
Martin,
Why don't you use the built in Rules Wizard to do all of this for you, you then just need a macro to run the rule ?
Bob
Re: Looking for help with an Outlook macro
OK, that's a good idea but unfortunately I have no experience in actually writing Outlook macros so I still would appreciate help with that.
1 Attachment(s)
Re: Looking for help with an Outlook macro
You don't need a macro to run a rule, just set up the rule, as per thje example below and turn it on.
Re: Looking for help with an Outlook macro
Martin, doesn the destination folder reside at the top level folder or is it a subfolder under the Inbox or such?
Almost done...
Edit: but the rule wont run by Ctl+P unless Martin wants to change it to automatic?
Re: Looking for help with an Outlook macro
Ok,assuming that the destination folder is at the same folder level as the Inbox... just add RegisterHotkey API code to invoke the procedure behind Outlook VBA (Press Alt+F11). If you dont want the hotkey then I can add code to add a menu item in Outlook or a toolbar button. Let me know. ;)
VB Code:
Option Explicit
'Behind Outlook VBA ThisOutlookSession
Private Sub MarkMovePokerEmails()
Dim oInbox As Outlook.MAPIFolder
Dim oEmail As Outlook.MailItem
Dim oPoker As Outlook.MAPIFolder
Dim i As Integer
Set oInbox = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set oPoker = Application.GetNamespace("MAPI").Folders("Poker Stars Wins")
'loop backwards to catch any current incoming emails
For i = oInbox.Items.Count To 1
If InStr(1, oInbox.Items.Item(i).Subject, "Results for PokerStars Tournament") > 0 Then
Set oEmail = oInbox.Items.Item(i)
oEmail.UnRead = False
oEmail.Save
oEmail.Move oPoker
Set oEmail = Nothing
DoEvents
End If
Next
Set oPoker = Nothing
Set oInbox = Nothing
End Sub
Re: Looking for help with an Outlook macro
Quote:
Originally Posted by DKenny
You don't need a macro to run a rule, just set up the rule, as per thje example below and turn it on.
Thanks. I've created it and as soon as I get a chance to play some poker I'll see if it works :) but I'm sure it will.