Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Contacts / November 2005

Tip: Looking for answers? Try searching our database.

Global replace for "File As"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dale303@gmail.com - 19 Nov 2005 18:44 GMT
After recently upgraging my mobile and using new sync software, all my
contacts "File As" settings have reverted to 'Last, First'.

Is there a way to reset ALL of my contact list to 'First, Last'?

As I've got 400+ contacts, I really don't want to have to do this
individually.
Russ Valentine [MVP-Outlook] - 19 Nov 2005 18:50 GMT
You'd have to use code:
http://support.microsoft.com/default.aspx?scid=kb;en-us;291144&Product=ol2002

Signature

Russ Valentine
[MVP-Outlook]

> After recently upgraging my mobile and using new sync software, all my
> contacts "File As" settings have reverted to 'Last, First'.
[quoted text clipped - 3 lines]
> As I've got 400+ contacts, I really don't want to have to do this
> individually.
Dale Walker - 19 Nov 2005 20:55 GMT
>You'd have to use code:
>http://support.microsoft.com/default.aspx?scid=kb;en-us;291144&Product=ol2002

Ouch. This help is for Outlook 2002 and differs slightly for Outlook
2003. Fortunately, the code itself works with just a simple copy and
paste but some of the instructions on other aspects of the procedure
are incorrect.

Here's my revised instructions for Outlook 2003 ('No warranties if
this screws anything up' usual blah blah applies)...

Anything '*' is a change to the original instructions (bracketed
comments are MS's old instructions that needed changing.)

----
1*. Just ignore this bit completely
(1. On the File menu, point to New, and then click Mail Message to
open a new e-mail message. )

2*. Highlight the Contacts folder, In the Tools menu, point to Forms,
and then click 'Design a Form'.
(2. On the Tools menu of the new e-mail message, point to Forms, and
then click Design This Form. )

3. Insert five Command buttons on the new form. To do this:a.  Click
the (P.2) tab to go to a blank page on the form.
b.  On the Form menu, click Control Toolbox, click CommandButton, and
then drag the button to the blank form page.
c.  Right-click the new button, click Properties, and then type
cmdLastFirst in the Name box.
d.  In the Caption box, type Last, First, and then click OK.
e.  In the Toolbox dialog box, click CommandButton, and then drag a
second button to the blank form page.
f.  Right-click the new button, click Properties, and then type
cmdFirstLast in the Name box.
g.  In the Caption box, type First Last, and then click OK.
h.  In the Toolbox dialog box, click CommandButton, and then drag a
third button to the blank form page.
i.  Right-click the new button, click Properties, and then type
cmdCompany in the Name box.
j.  In the Caption box, type Company, and then click OK.
k.  In the Toolbox dialog box, click CommandButton, and then drag a
fourth button to the blank form page.
l.  Right-click the new button, click Properties, and then type
cmdLastFirstCompany in the Name box.
m.  In the Caption box, type Last, First (Company), and then click OK.
n.  In the Toolbox dialog box, click CommandButton, and then drag a
fifth button to the blank form page.
o.  Right-click the new button, click Properties, and then type
cmdCompanyLastFirst in the Name box.
p.  In the Caption box, type Company (Last, First), and then click OK.
4. Type the following Visual Basic Scripting Edition (VBScript) code.
To do this:a.  On the Form menu, click View Code to open the Script
Editor.
b.  In the Script Editor, type or copy the following code:Option
Explicit
Dim strSortBy

Sub cmdLastFirst_Click()
  strSortBy = "LastFirst"
  UpdateContacts
End Sub

Sub cmdFirstLast_Click()
  strSortBy = "FirstLast"
  UpdateContacts
End Sub

Sub cmdCompany_Click()
  strSortBy = "Company"
  UpdateContacts
End Sub

Sub cmdLastFirstCompany_Click()
  strSortBy = "Last, First (Company)"
  UpdateContacts
End Sub

Sub cmdCompanyLastFirst_Click()
  strSortBy = "Company (Last, First)"
  UpdateContacts
End Sub

Sub UpdateContacts()

  Dim CurFolder
  Dim MyItems
  Dim MyItem
  Dim NumItems, i

  ' Use whichever folder is currently selected
  Set CurFolder = Application.ActiveExplorer.CurrentFolder

  ' Make sure it's a contact folder
  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
     NumItems = MyItems.Count
     For i = 1 to NumItems
        Set MyItem = MyItems.Item(i)
        ' Make sure it's not a distribution list in the folder
        ' (really only applies to OL98 and OL2000)
        If TypeName(MyItem) = "ContactItem" Then
           Select Case strSortBy
              Case "LastFirst"
                 If MyItem.LastNameandFirstName <> "" Then
                    MyItem.FileAs = MyItem.LastNameandFirstName
                 Else
                    MyItem.FileAs = MyItem.CompanyName
                 End IF
              Case "FirstLast"
                 If MyItem.Subject <> "" Then
                    MyItem.FileAs = MyItem.Subject
                 Else
                    MyItem.FileAs = MyItem.CompanyName
                 End IF
              Case "Company"
                 If MyItem.CompanyName <> "" Then
                    MyItem.FileAs = MyItem.CompanyName
                 Else
                    MyItem.FileAs = MyItem.LastNameandFirstName
                 End IF
              Case "Last, First (Company)"
                 MyItem.FileAs = MyItem.LastNameAndFirstName
                 If MyItem.CompanyName <> "" Then
                    If MyItem.FileAs <> "" Then
                       MyItem.FileAs = MyItem.FileAs & " (" & _
                                       MyItem.CompanyName & ")"
                    Else
                       MyItem.FileAs = MyItem.FileAs & _
                                 MyItem.CompanyName
                    End If
                 End If
              Case "Company (Last, First)"
                 MyItem.FileAs = MyItem.CompanyName
                 If MyItem.LastNameandFirstName <> "" Then
                    If MyItem.FileAs <> "" Then
                       MyItem.FileAs = MyItem.FileAs & " (" & _
                              MyItem.LastNameAndFirstName & ")"
                    Else
                       MyItem.FileAs = MyItem.FileAs & _
                              MyItem.LastNameAndFirstName
                    End If
                 End If
           End Select
           MyItem.Save
        End If           ' check TypeName
     Next
     MsgBox "Finished updating contacts."
  Else
     MsgBox "The current folder must be a contacts folder."
  End If                 ' check contacts folder

  Set MyItem = Nothing
  Set MyItems = Nothing
  Set CurFolder = Nothing

End Sub
                       

c.  On the File menu in Script Editor, click Close to return to the
form.

d*. Highlight p.2 tab
(d.  Click the Message page of the form.)

e*  On the Form menu, make sure 'Display this Page' is highlighted.
Advice form Microsoft meant I could not access the new form at all.
(e.  On the Form menu, click Display This Page. This hides the form
page so that it does not appear when the form is used. )

5. Publish the form. To do this:a.  On the Tools menu, point to Forms,
and then click Publish Form As.
b.  Verify that next to the Look in button you see Personal Forms
Library.
c.  In the Display name box, type a discriptive name for your new form
(such as, Change File As fields), and then click Publish.
d.  When you are prompted to save the form definition with the item,
click No.
e.  Close the message without saving it.


Back to the top

How to Use the Custom Form
To use your new form: 1. Locate the Contact folder that you want to
re-sequence.
2. On the File menu, point to New, and then click Choose Form.
3. Change the Look in box to Personal Forms Library, click your new
form, and then click OK.
4. Click the appropriate button to update the File As field.
----

Well that's it. Still a little of an untidy way to do things but at
least it works. I also managed to modify the code so that I got
"First, Last (Company)" which isn't usually an option. I'm still
waiting to see if that's a dangerous thing to attempt but so far
things seem to be working out fine.

Signature

Dale Walker
London Techno Events
dale@sorted,org
http://london.sorted.org

Russ Valentine [MVP-Outlook] - 19 Nov 2005 21:55 GMT
Thanks. Looks like the KB could use an update.
Signature

Russ Valentine
[MVP-Outlook]

>
>>You'd have to use code:
[quoted text clipped - 194 lines]
> waiting to see if that's a dangerous thing to attempt but so far
> things seem to be working out fine.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.