Edit a Folder View

See how to edit the view settings of a folder.

Last modified: 2009/11/18 | Accessed: 16.518  | #78
◀ Previous sample Next sample ▶
Determine the "identity" of your emails. Set with SAM the sender, signature and folder for sent items with the help of rules.

You can comfortably switch the current view via View/Current View. But of course, you can do that also with VBA as this example demonstrates: For the current folder the view is switched to "Simple List". If the view doesn't exist for the current folder, nothing happens.

(The sample works for up to Outlook 2010.)

tip  How to add macros to Outlook
Public Sub SwitchView()
  Dim Bars As Office.CommandBars
  Dim Popup As Office.CommandBarPopup
  Dim Btn As Office.CommandBarButton
  Dim ViewName As String

  ViewName = "Simple List"

  ViewName = LCase$(ViewName)
  Set Bars = Application.ActiveExplorer.CommandBars
  Set Popup = Bars.FindControl(, 30124)
  If Not Popup Is Nothing Then
    For Each Btn In Popup.Controls
      If LCase$(Btn.Caption) = ViewName Then
        Exit For
      End If
  End If
End Sub
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
email  Send a message