Solved

Warn me when there is a duplicate followup.That has a exact Subject match.

Posted on 2009-07-03
17
204 Views
Last Modified: 2012-05-07
Hi,

Warn me when there is a duplicate followup.That has a exact Subject match.
I click the followup flag red as to do jobs as and when i get and read the email. There are times when i click the followup on similiar mails. So when there is a match with the subject of just the followup mails then popup a box with the subject and say it has a duplicate.

Regards
Sharath
0
Comment
Question by:bsharath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 5
17 Comments
 
LVL 28

Expert Comment

by:peakpeak
ID: 24805422
You might find some code to scratch from here:
http://www.outlookcode.com (download Sues code examples)
http://www.slovaktech.com/code_samples.htm
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24835428
sharath,

I may be able to do this, but I don't think the result will be practical.  Especially if you want it to search more than a few folders for items with matching subjects.  Unfortunately Outlook doesn't trigger a unique event when an item is flagged.  The best you can do is watch for the item changing when the flag is applied.  That's a little cumbersome.  Then there's the problem of searching for a duplicate.  Outlook's advanced search requires specifying the folders to search.  Searching a few folders, a half-dozen or less, isn't a problem, but searching dozens of folders would be.  Then there's the speed of the search to consider.  Searching one folder with a few hundred items is pretty quick, but searching thousands of messages spread across multiple folders is going to produce a very noticeable lag.  I just don't think it's very practical.

peakpeak,

You post the same information to a lot of questions.  You might as well post "Go search Google for an answer."  It doesn't help the author of the question.  You should at least take the time to search those sites for code that's relevant to what the person is asking.  I know your moto is "Never reinvent the Wheel. Use Google." and I agree with you that authors could answer a lot of their own questions by doing a simple search.  The fact is that folks are paying money to get help with a question not to be told to go search for it themselves.  It'd be like you taking your car to a mechanic to diagnose a problem and the mechanic telling you to look in an auto manual because he knows the answer is there.  
0
 
LVL 11

Author Comment

by:bsharath
ID: 24836863
Hi David,

The only place i want to check for Duplicate Subjecdts when flagged is the Mailbox (Inbox)
I will have 1 flagged already and if i flag the 2nd one then popup a box.

I guess this would be easier...
As once i comple all the jobs only then i Move the mails to my psts and relevant folders
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:bsharath
ID: 24836864
Hi David,

The only place i want to check for Duplicate Subjecdts when flagged is the Mailbox (Inbox)
I will have 1 flagged already and if i flag the 2nd one then popup a box.

I guess this would be easier...
As once i comple all the jobs only then i Move the mails to my psts and relevant folders
0
 
LVL 11

Author Comment

by:bsharath
ID: 24962106
Hi David any views on this
0
 
LVL 11

Author Comment

by:bsharath
ID: 25005476
Hi David any views....
0
 
LVL 11

Author Comment

by:bsharath
ID: 25066207
Hi David...Any views on this please...
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 25110063
This should do it.  This code goes in the ThisOutlookSession module.
Dim WithEvents olkExplorers As Outlook.Explorers
Dim WithEvents olkExplorer As Outlook.Explorer
Dim WithEvents olkItem As Outlook.MailItem
Dim bolDuplicateItem As Boolean
 
Private Sub Application_Quit()
    Set olkExplorers = Nothing
    Set olkExplorer = Nothing
    Set olkItem = Nothing
End Sub
 
Private Sub Application_Startup()
    Set olkExplorers = Application.Explorers
    Set olkExplorer = Application.ActiveExplorer
End Sub
 
Private Sub olkExplorer_Activate()
    Set olkExplorer = Application.ActiveExplorer
End Sub
 
Private Sub olkExplorer_SelectionChange()
    Set olkItem = Application.ActiveExplorer.Selection(1)
End Sub
 
Private Sub olkExplorers_NewExplorer(ByVal Explorer As Explorer)
    Set olkExplorer = Explorer
End Sub
 
Private Sub olkItem_PropertyChange(ByVal Name As String)
    If Name = "FlagStatus" Then
        If olkItem.FlagStatus = olFlagMarked Then
            bolDuplicateItem = IsDuplicate()
        End If
    End If
End Sub
 
Private Sub olkItem_Write(Cancel As Boolean)
    If bolDuplicateItem Then
        If msgbox("You already have an item with this subject flagged for action." & vbCrLf & "Flag anyway?", vbQuestion + vbYesNo, "Check for Flagged Duplicates") = vbNo Then
            Cancel = True
        Else
            Cancel = False
        End If
    End If
    bolDuplicateItem = False
End Sub
 
Function IsDuplicate() As Boolean
    Dim olkItems As Outlook.Items, olkMessage As Outlook.MailItem
    Set olkItems = Session.GetDefaultFolder(olFolderInbox).Items.Restrict("[Subject] = '" & olkItem.Subject & "'")
    For Each olkMessage In olkItems
        If olkMessage.FlagStatus = olFlagMarked Then
            If olkMessage.EntryID <> olkItem.EntryID Then
                IsDuplicate = True
                Exit For
            End If
        End If
    Next
    Set olkItems = Nothing
    Set olkMessage = Nothing
End Function

Open in new window

0
 
LVL 11

Author Comment

by:bsharath
ID: 25111406
Thanks David...
Mailed you the code...I get a sub error... Can you help combine my code with this code please...
0
 
LVL 76

Expert Comment

by:David Lee
ID: 25119512
Done.
0
 
LVL 11

Author Comment

by:bsharath
ID: 25119839
David i did add the code you gave and when i select the Flag on 2 identical Subject mails i get no warning...
0
 
LVL 76

Expert Comment

by:David Lee
ID: 25121375
Are the messages in the Inbox?
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121384
Yes both the messages are in the inbox
0
 
LVL 76

Expert Comment

by:David Lee
ID: 25121409
Did you close and restart Outlook after adding the code?
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121421
Yes i did restart... Just going to try a log off
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121599
Thanks a lot David Worked perfect after a restart... :-)
0
 
LVL 11

Author Comment

by:bsharath
ID: 25121852
Hi David,

When i click on the deleted folder. I get the attached error. Can you please suggest

Capture.JPG
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question