Article ID: 165139
Article Last Modified on 1/19/2007
Sub CommandButton1_Click()
'This will sort ONLY contacts in CURRENT folder by LastName, FirstName
Set CurFolder=Application.ActiveExplorer.CurrentFolder
If CurFolder.DefaultItemType=2 Then
MsgBox "This process may take some time. You will be notified" & _
"when complete.",,"Contact Tools Message"
Set MyItems=CurFolder.Items
For i = 1 to MyItems.Count
Set MyItem=MyItems.Item(i)
If Trim(MyItem.LastNameandFirstName)<>"" Then
MyItem.Subject=MyItem.LastNameandFirstName
MyItem.Save
End If
Next
MsgBox "Done sorting Outlook Address Book contacts by Last" & _
" Name!",64,"Contact Tools Message"
Else
MsgBox "The current folder is not a Contact folder.",64,"Contact" & _
"Tools Message"
End If
End Sub
Sub CommandButton2_Click()
'This will reset contacts in CURRENT folder to FirstName LastName
Set CurFolder=Application.ActiveExplorer.CurrentFolder
If CurFolder.DefaultItemType=2 Then
MsgBox "This process may take some time. You will be notified" & _
"when complete.",,"Contact Tools Message"
Set MyItems=CurFolder.Items
For i = 1 to MyItems.Count
Set MyItem=MyItems.Item(i)
If Trim(MyItem.FullName)<>"" Then
MyItem.Subject=MyItem.FullName
MyItem.Save
End If
Next
MsgBox "Done sorting Outlook Address Book contacts by First" & _
" Name!",64,"Contact Tools Message"
Else
MsgBox "The current folder is not a Contact folder.",64,"Contact" & _
" Tools Message"
End If
End Sub
151261 OFF97: How to Obtain and Install MS Office 97 SR-2
166368 OL97: How to Get Help Programming with Outlook
170783 OL97: Q&A: Questions about Customizing or Programming Outlook
Additional query words: OutSol OutSol97
Keywords: kbhowto kbsample kbusage KB165139