<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Normal Chaos &#187; Macro</title>
	<atom:link href="http://wp.normalchaos.com/wordpress/archives/tag/macro/feed" rel="self" type="application/rss+xml" />
	<link>http://wp.normalchaos.com/wordpress</link>
	<description>where chaos is the norm</description>
	<lastBuildDate>Fri, 20 Nov 2009 18:02:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Removing Duplicate Notes from Outlook</title>
		<link>http://wp.normalchaos.com/wordpress/archives/34</link>
		<comments>http://wp.normalchaos.com/wordpress/archives/34#comments</comments>
		<pubDate>Fri, 20 Nov 2009 17:49:20 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Macros]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Useful Tips]]></category>
		<category><![CDATA[Macro]]></category>

		<guid isPermaLink="false">http://wp.normalchaos.com/wordpress/?p=34</guid>
		<description><![CDATA[Here is a simple macro to remove duplicate note items from Outlook.  Notes are much simpler than contacts or events, because either they are identical, or they are two different notes.
Instructions
1. From Outlook, open your macro editor. (Either press alt-F11 or select Tools, Macro, Visual Basic Editor.)
2. In the macro editor window, select Insert, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple macro to remove duplicate note items from Outlook.  Notes are much simpler than contacts or events, because either they are identical, or they are two different notes.</p>
<p><b>Instructions</b><br />
1. From Outlook, open your macro editor. (Either press alt-F11 or select Tools, Macro, Visual Basic Editor.)<br />
2. In the macro editor window, select Insert, Module. This will create a text editor window into which you can paste the macro.<br />
3. In the text editor window, paste in the code below. (I recommend you review the code to be sure it’s doing what you want.)<br />
4. You can run the code by placing your cursor anywhere in the code window between the “Sub” and “End Sub” statements and pressing F5. Optionally, you can close the Visual Basic window, then select Tools, Macro, Macros…, and “Run” RemoveDuplicateNotes.</p>
<p>Here is the code for the macro. Hopefully, it is useful to someone. Please let me know if you have any problems so I can correct make an effort to correct the macro.</p>
<p><b>IMPORTANT</b> A regular copy/paste should work correctly. However, you may experience issues with line breaks that prevent the macro from working. If this is the case, the Outlook VB editor will make it abundantly clear what lines are invalid, so it should be pretty easy to fix rogue line wrapping.</p>
<pre>
':::::::::::::::::: Macro Begins Here; Copy this line and everything below
Sub RemoveDuplicateNotes()
    Dim olApp As Outlook.Application
    Dim olNote1 As Outlook.NoteItem
    Dim olNote2 As Outlook.NoteItem
    Dim olItems As Outlook.Items
    Dim olNS As Outlook.NameSpace

    Set olApp = New Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    Set olItems = olNS.GetDefaultFolder(olFolderNotes).Items
    olItems.Sort ("Subject")
    Dim DeleteCount As Integer
    Dim z As Integer
    DeleteCount = 0

    For z = olItems.Count To 2 Step -1
        Set olNote1 = olItems.Item(z)
        Set olNote2 = olItems.Item(z - 1)
        DoEvents
        If InStr(1, olNote1.Subject, "Pay Attention") Then
            Debug.Print olNote1.Subject
            Debug.Print "Create Time: " &#038; olNote1.CreationTime
            Debug.Print "Mod time:  " &#038; olNote1.LastModificationTime
        End If
        If olNote1.Body = olNote2.Body Then
            olNote1.Delete
            Debug.Print "Note item " &#038; Left(olNote2.Subject, 25) &#038; "..." &#038; " deleted"
            DeleteCount = DeleteCount + 1
        End If
    Next
    MsgBox DeleteCount &#038; " duplicate Outlook Notes have been removed"
End Sub

':::::::::::::::::: Macro Ends Here
</pre>
<p>* This macro was developed using Outlook 2003. It works very well for me, but I make no guarantee it will work for you. Please review the code before running to be sure it doesn’t perform some task you are not expecting. Also, I strongly recommend backing up your Outlook data (usually a PST file) before running the macro.</p>
<p>Please leave feedback letting me know whether or not it works for you. If you have problems with it, please let me know that as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.normalchaos.com/wordpress/archives/34/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing Duplicate Contacts from Outlook</title>
		<link>http://wp.normalchaos.com/wordpress/archives/30</link>
		<comments>http://wp.normalchaos.com/wordpress/archives/30#comments</comments>
		<pubDate>Fri, 20 Nov 2009 17:10:24 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Macros]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Useful Tips]]></category>
		<category><![CDATA[Contacts]]></category>
		<category><![CDATA[Macro]]></category>

		<guid isPermaLink="false">http://wp.normalchaos.com/wordpress/?p=30</guid>
		<description><![CDATA[One major issue with synchronizing multiple devices is that you end up with duplicates.  Specifically, you may end up with 2 or 3 contact entries for the same person.  This issue inspired me to write a simple macro to remove duplicate contact records.
The following Outlook macro (and instructions) will assist you in removing [...]]]></description>
			<content:encoded><![CDATA[<p>One major issue with synchronizing multiple devices is that you end up with duplicates.  Specifically, you may end up with 2 or 3 contact entries for the same person.  This issue inspired me to write a simple macro to remove duplicate contact records.</p>
<p>The following Outlook macro (and instructions) will assist you in removing duplicate contacts. This macro will not merge contacts if they are slightly different, but it simply checks contact records to determine if the names, phone numbers, e-mail addresses, and mailing addresses match.  If so, it removes one of them.  If the key fields match, but the mailing or business address is different, you will be alerted of the discrepancy, and both records will be retained.  </p>
<p>It is important to remember that this macro does not compare notes or other (less significant) fields.  (At some point, I would like to update the macro to merge contact records if I ever get enough time.)</p>
<p><b>Instructions</b><br />
1. From Outlook, open your macro editor. (Either press alt-F11 or select Tools, Macro, Visual Basic Editor.)<br />
2. In the macro editor window, select Insert, Module. This will create a text editor window into which you can paste the macro.<br />
3. In the text editor window, paste in the code below. (I recommend you review the code to be sure it’s doing what you want.)<br />
4. You can run the code by placing your cursor anywhere in the code window between the “Sub” and “End Sub” statements and pressing F5. Optionally, you can close the Visual Basic window, then select Tools, Macro, Macros…, and “Run” RemoveDuplicateContacts.</p>
<p>Here is the code for the macro. Hopefully, it is useful to someone. Please let me know if you have any problems so I can correct make an effort to correct the macro.</p>
<p><b>IMPORTANT</b> A regular copy/paste should work correctly. However, you may experience issues with line breaks that prevent the macro from working. If this is the case, the Outlook VB editor will make it abundantly clear what lines are invalid, so it should be pretty easy to fix rogue line wrapping.</p>
<pre>
':::::::::::::::::: Macro Begins Here; Copy this line and everything below
Sub RemoveDuplicateContacts()
    Dim StatusMessage As String
    Dim olApp As Outlook.Application
    Dim olContact1 As Outlook.ContactItem
    Dim olContact2 As Outlook.ContactItem
    Dim olItems As Outlook.Items
    Dim olNS As Outlook.NameSpace

    Set olApp = New Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    Set olItems = olNS.GetDefaultFolder(olFolderContacts).Items
    olItems.Sort ("File As")
    Dim DeleteCount As Integer
    Dim z As Integer
    DeleteCount = 0
    StatusMessage = ""
    For z = olItems.Count To 2 Step -1
        On Error GoTo GroupFound:
ContinueAfterGroup:
        Set olContact1 = olItems.Item(z)
        Set olContact2 = olItems.Item(z - 1)
        On Error GoTo Error1:
        DoEvents
        ' Check key fields to make sure this is a duplicate
        ' Compare first and last names, home phone, mobile phone, and
        ' all 3 e-mail addresses to make sure nothing gets overlooked.
        ' Assume all other fields are the same or unimportant
        If olContact1.FileAs = olContact2.FileAs _
            And olContact1.FirstName = olContact2.FirstName _
            And olContact1.LastName = olContact2.LastName _
            And olContact1.Email1Address = olContact2.Email1Address _
            And olContact1.Email2Address = olContact2.Email2Address _
            And olContact1.Email3Address = olContact2.Email2Address _
            And olContact1.HomeTelephoneNumber = olContact2.HomeTelephoneNumber _
            And olContact1.MobileTelephoneNumber = olContact2.MobileTelephoneNumber _
          Then
            'Determine whether or not addresses exist
            If olContact1.MailingAddress = olContact2.MailingAddress _
                And olContact1.BusinessAddress = olContact2.BusinessAddress Then
                olContact1.Delete
                StatusMessage = StatusMessage &#038; "Contact item " &#038; olContact2.FileAs &#038; _
                    " deleted" &#038; vbCrLf &#038; vbCrLf
                Debug.Print "Contact item " &#038; olContact2.FileAs &#038; " deleted"
                DeleteCount = DeleteCount + 1
            Else
                StatusMessage = StatusMessage &#038; "Mailing addresses are not the same for contacts " &#038; _
                    olContact1.FileAs &#038; "." &#038; vbCrLf &#038; _
                    "Contact not deleted. You may want to manually update " &#038; _
                    "the contact information." &#038; vbCrLf &#038; vbCrLf
                Debug.Print "Mailing addresses are not the same for contacts " &#038; _
                    olContact1.FileAs &#038; ".  Please investigate."
            End If
        End If
    Next
    MsgBox DeleteCount &#038; " duplicate Outlook Contacts have been removed" &#038; _
        vbCrLf &#038; vbCrLf &#038; StatusMessage
    Exit Sub
GroupFound:
    z = z - 1
    Resume ContinueAfterGroup:
Error1:
    MsgBox "Whoops!  Something went horribly wrong (but your contacts are just fine)!"
End Sub
':::::::::::::::::: Macro Ends Here
</pre>
<p>* This macro was developed using Outlook 2003. It works very well for me, but I make no guarantee it will work for you. Please review the code before running to be sure it doesn’t perform some task you are not expecting. Also, I strongly recommend backing up your Outlook data (usually a PST file) before running the macro.</p>
<p>Please leave feedback letting me know whether or not it works for you. If you have problems with it, please let me know that as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.normalchaos.com/wordpress/archives/30/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing Duplicate Events in Outlook</title>
		<link>http://wp.normalchaos.com/wordpress/archives/25</link>
		<comments>http://wp.normalchaos.com/wordpress/archives/25#comments</comments>
		<pubDate>Fri, 20 Nov 2009 16:39:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[Macros]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Useful Tips]]></category>
		<category><![CDATA[Macro]]></category>

		<guid isPermaLink="false">http://wp.normalchaos.com/wordpress/?p=25</guid>
		<description><![CDATA[For those of you who use Outlook as your primary (or even, secondary) scheduling tools, you have probably experience issues with Outlook having duplicate events.  This is especially problematic if you synchronize your Outlook calendar across multiple devices.  In a perfect world, those devices would identify the duplicates and merge them.  Reality, [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who use Outlook as your primary (or even, secondary) scheduling tools, you have probably experience issues with Outlook having duplicate events.  This is especially problematic if you synchronize your Outlook calendar across multiple devices.  In a perfect world, those devices would identify the duplicates and merge them.  Reality, however, is significantly different.</p>
<p>The following Outlook macro (and instructions) will assist you in removing duplicate events.  This macro will not merge events if they are slightly different, but it simply checks to see if two events are EXACTLY the same, and it removes one of them.</p>
<p><b>Instructions</b><br />
1.  From Outlook, open your macro editor.  (Either press alt-F11 or select Tools, Macro, Visual Basic Editor.)<br />
2.  In the macro editor window, select Insert, Module.  This will create a text editor window into which you can paste the macro.<br />
3.  In the text editor window, paste in the code below.  (I recommend you review the code to be sure it's doing what you want.)<br />
4.  You can run the code by placing your cursor anywhere in the code window between the "Sub" and "End Sub" statements and pressing F5.  Optionally, you can close the Visual Basic window, then select Tools, Macro, Macros..., and "Run" RemoveDuplicateEvents.</p>
<p>The last section of the macro removes all items from your Deleted Items folder.  I discovered this is important, because events in my Deleted Items folder "mysteriously" kept re-duplicating.  Once I cleaned out the folder, my sync'ing was successful.</p>
<p>Here is the code for the macro.  Hopefully, it is useful to someone.  Please let me know if you have any problems so I can correct make an effort to correct the macro.</p>
<p><b>IMPORTANT</b> A regular copy/paste should work correctly.  However, you may experience issues with line breaks that prevent the macro from working.  If this is the case, the Outlook VB editor will make it abundantly clear what lines are invalid, so it should be pretty easy to fix rogue line wrapping.</p>
<pre>
':::::::::::::::::: Macro Begins Here; Copy this line and everything below
Sub RemoveDuplicateEvents()
    Dim olApp As Outlook.Application
    Dim olAppointment1 As Outlook.AppointmentItem
    Dim olAppointment2 As Outlook.AppointmentItem
    Dim olItems As Outlook.Items
    Dim olDeletedItems As Outlook.Items
    Dim olNS As Outlook.NameSpace
    Dim SkipConfirmation As Boolean

    Set olApp = New Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    Set olItems = olNS.GetDefaultFolder(olFolderCalendar).Items
    Set olDeletedItems = olNS.GetDefaultFolder(olFolderDeletedItems).Items

    olItems.Sort ("Subject")
    olItems.Sort ("Start")
    Dim DeleteCount As Integer
    Dim z As Integer
    Dim FreeBusyStatus As Boolean
    DeleteCount = 0

    FreeBusyStatus = MsgBox("Do you want to set the status for all-day events to 'Free'?", vbYesNo, "Set Free Busy Status") = vbYes
    If FreeBusyStatus Then
        SkipConfirmation = Not MsgBox("Do you want to be prompted to set free times for all-day events?", vbYesNo, "Skip Confirmation?") = vbYes
    End If

    For z = olItems.Count To 2 Step -1

             Set olAppointment1 = olItems.Item(z)
             Set olAppointment2 = olItems.Item(z - 1)
             Debug.Print olAppointment1.Subject &#038; vbCrLf &#038; olAppointment2.Subject
             DoEvents

             With olAppointment1
                 If .Subject = olAppointment2.Subject And _
                         .Start = olAppointment2.Start Then
                     .Delete
                     Debug.Print "Calendar item " &#038; Left(olAppointment2.Subject, 25) &#038; "..." &#038; " deleted"
                     DeleteCount = DeleteCount + 1
                 End If
             End With
             With olAppointment2
                 If .AllDayEvent And .BusyStatus <> olFree And FreeBusyStatus Then
                     If Not SkipConfirmation Then
                         If MsgBox("Do you want to set """ &#038; .Subject &#038; """ as free time?", vbYesNo, "Confirm Status Change") = vbYes Then
                             .BusyStatus = olFree
                             .Save
                             Debug.Print .Subject &#038; " updated!"
                         End If
                     Else
                         .BusyStatus = olFree
                         .Save
                         Debug.Print .Subject &#038; " updated!"
                     End If
                 End If
             End With
    Next
    If MsgBox(DeleteCount &#038; " duplicate Outlook calendar items have been removed." &#038; _
        vbCrLf &#038; "Do you want to clear your deleted items folder?" &#038; vbCrLf &#038; _
        "(This must be done to prevent re-syncing 'deleted' entries)", vbYesNo, "Confirm Deleted Items Removal") = vbYes Then
        ' Clear deleted items folder
        For z = olDeletedItems.Count To 1 Step -1
            olDeletedItems.Item(z).Delete
            DoEvents
        Next
    End If
    MsgBox "Cleanup Complete!", vbOKOnly, "End of Processing"

End Sub

':::::::::::::::::: Macro Ends Here
</pre>
<p>* This macro was developed using Outlook 2003.  It works very well for me, but I make no guarantee it will work for you.  Please review the code before running to be sure it doesn't perform some task you are not expecting.  Also, I strongly recommend backing up your Outlook data (usually a PST file) before running the macro.</p>
<p>Please leave feedback letting me know whether or not it works for you.  If you have problems with it, please let me know that as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.normalchaos.com/wordpress/archives/25/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

