Solved

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

Posted on 2009-07-03
17
199 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
  • 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now