J
JeffG
I am new to Outlook macros and I could use a lot of help. I am using Office
2007 on an XP-SP3 machine. I am trying to write a little macro that will
sort a list and then delete duplicate lines. Thanks to Greg Maxey I can do
this in Word but, of course, that code doesn’t work in an Outlook message.
The code Greg shows is as follows:
Sub SortAndRemoveDuplicatesFromList()
Dim oPars As Paragraphs
Dim oPar As Paragraph
Dim myCol As New Collection
Set oPars = Selection.Paragraphs
If oPars.Count > 1 Then
Selection.Sort SortOrder:=wdSortOrderAscending
Else
MsgBox "There is no valid selection to sort"
Exit Sub
End If
For Each oPar In ActiveDocument.Range.Paragraphs
On Error Resume Next
myCol.Add oPar.Range.Text, oPar.Range.Text
If Err.Number = 457 Then oPar.Range.Delete
Next
End Sub
How can I get something similar that works in an Outlook message?
Thanks in advance for any help.
2007 on an XP-SP3 machine. I am trying to write a little macro that will
sort a list and then delete duplicate lines. Thanks to Greg Maxey I can do
this in Word but, of course, that code doesn’t work in an Outlook message.
The code Greg shows is as follows:
Sub SortAndRemoveDuplicatesFromList()
Dim oPars As Paragraphs
Dim oPar As Paragraph
Dim myCol As New Collection
Set oPars = Selection.Paragraphs
If oPars.Count > 1 Then
Selection.Sort SortOrder:=wdSortOrderAscending
Else
MsgBox "There is no valid selection to sort"
Exit Sub
End If
For Each oPar In ActiveDocument.Range.Paragraphs
On Error Resume Next
myCol.Add oPar.Range.Text, oPar.Range.Text
If Err.Number = 457 Then oPar.Range.Delete
Next
End Sub
How can I get something similar that works in an Outlook message?
Thanks in advance for any help.