Link to home
Start Free TrialLog in
Avatar of WRTit
WRTitFlag for United States of America

asked on

Restricting Outlook sorting by dates

Is it possible to have Outlook permanently display emails in date order (newest to oldest) and restrict the user(s) from changing this column sort order?
Example: User gets a very high volume of email and is not computer savvy. The inbox starts out in date order but by the end of the day ends up in either a TO: order or a FROM: order etc.
The user ends up scrolling through hundreds of emails all day looking for new ones.

We all realize that this is as simple as clicking on the header of the column and resorting by date, but that does not get comprehended.
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

yes it can be done thru vba?
"but that does not get comprehended"
You mean the user does not comprehend your advice or that Outlook does not resort when you click the Received column?

Just tell the user to not click on the column headings.
Avatar of WRTit


Outlook works just fine. This is a user issue. You would think that telling them not to click on the headers would be so simple.
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WRTit


Yes, that would be great. Sorry about that....
WRTit--Remove the columns  see last paragraph.

It will take a moderate level of computer savvy to figure out how to restore.
will removing a column be a solution for you like jcimarron pointed out ?
or else if you still prefer a vba solution then I would it up for you.
In outlook itself you cannot restrict a users ability to modify their own personal views.

I suppose you could use a VBA

Alternatively you could use what we do on some of our shared computers w/ outlook accounts

Simply set the shortcut path to outlook to

"C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" /cleanviews

What this does, for us, enables the current user to modify or change their view in outlook however they like. Accidental or Not

When outlook is closed and re-opened
the clean views switch is ran
When this command line switch runs, it clears any and all custom / modified views retting it back to outlooks default

Which is by date/Most Recent at Top
Avatar of WRTit


I believe going with the VBA will be the best route.
Avatar of WRTit


yes please!
ok fine working on it. got part but need to finetune it so it will ensure no matter what users do that sorting will be correct. Be patient !

OOPS Just saw you closed this question and still hv not provided you wit the solution !!! Why did you do that  ??? Anyway will work on it to provide you the best I can pls be patient.
Are you intrested to get the vba solution ? I have it here:

To install it do the following:
1) Open outlook and choose from the tools menu Macros then choose Visual Basic Editor.
2) You will see on the left Pane Project1 (VBAProject.OTM) keep on clicking on the + till you will see ThisOutlookSession doubleclick on it
3) In the right pane you will get a blank page if you had not previously had a VBA code in Outlook.
4) Paste the below code in that page

Public WithEvents myOlExp As Outlook.Explorer
Public WithEvents myOlInsp As Outlook.Inspector

Private Sub Application_Startup()

    Set myOlExp = Application.ActiveExplorer
    Set myOlInsp = Application.ActiveInspector

End Sub

Private Sub Application_ItemLoad(ByVal Item As Object)
End Sub

Public Sub myOlExp_ViewSwitch()
    If myOlExp.CurrentView <> "Messages" Then myOlExp.CurrentView = "Messages"

End Sub

Open in new window

5) Right click on the first line in the left Pane Project1 and choose Insert Module
6) In the module created please paste the below code there.

Sub ResetViewSorting()

Dim myOlExp As Outlook.Explorer
Dim myOlTblView As TableView
Dim myOlSel As Outlook.Selection
Dim x As Integer
Dim sFilter As String

Set myOlExp = Application.ActiveExplorer
Set myOlSel = myOlExp.Selection
Set myOlTblView = myOlExp.CurrentView
Select Case myOlExp.CurrentFolder.Name
    Case "Inbox"
        myOlExp.CurrentView = "Messages"
        If myOlTblView.SortFields.Item("Received").IsDescending Then
            x = MsgBox("View Has been modified from Initial setting and will be rest. Please locate your last message to continue work.", vbCritical, "Reseting View to Default")
            myOlTblView.SortFields.Item("Received").IsDescending = False
        End If
        sFilter = "[Subject] = " & Chr(34) & myOlSel.Item(1).Subject & Chr(34)
        sFilter = Replace(sFilter, "'", "''")
        myOlExp.CurrentFolder.Items.Find sFilter
    Case Else
End Select

End Sub

Open in new window

7) Press on the SAVE button and make sure before you exit that your macro security will prompt you to accept or refuse acroes.
8) Exit Outlook
9) Start outllok it should prompt you wether to accept Macroes Enable Macroes
and check the result.

The macro here will set the sorting to oldest on top and newest in the bottom for Inbox folders only the other folders are free !! this can be changed. Also if the user click on Date to change the sorting then as soon as he clicks on any item it will warn him that the sorting has been changed and it will be reset upon saying ok it will reset to default the sort. Also if the user changes the view to anything but messages it will revert automatically to Messages view.

Let me know your comments.
Hello WRTit,
Did you had a chance to try the proposed 'REAL SOLUTION' !!! ??? pls let me know your comments and if any problem so we can address and fix it.
Avatar of WRTit


sorry about closing the case. This should do the trick. I may be able to do this today, depending on their workload. If not 6am tomorrow for sure. i have to admit, i want to make time though, its exciting that the non sense will stop! ha ha.

Thought: if I wanted the newest on top, I can change the "IsDescending" to IsAscending", correct?

I will try as is first of coarse.

Thank you very much!
Yes sure let me know the results I will keep monitoring this question. No for IsAscending does not exist. Anyway let me know and I will give you the tricks for you to control this. But first lets make sure it works like you envisoned it.
Any news on your trial hv u had a chance to test the code ?
Avatar of WRTit


Hello gowflow, I had fallen ill for quite sometime but am back, i have just put this in place and i works wonderfully!
what syntax can i switch to reverse the sort order to the newest on top? seems backwards i know, but this user is the supervisor and needs to see it in that fashion.

p.s. i really enjoy how when you try to change the viewing order it warns you and switches it right back, wonderful!