Apply Method

Microsoft Outlook Visual Basic

Applies the view or applies the changes that have been made in a custom property page.

expression.Apply

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

Because the PropertyPage is an abstract object that is implemented in your application (rather than by Microsoft Outlook itself), the implementation of the Apply method resembles an event procedure in your program code. That is, you write the code that implements the method in much the same way you would write an event procedure. In other words, Outlook calls the Apply method to notify your program that the user has taken an action in the dialog box displaying the custom property page that requires your program to apply the property values changed by the user.

Example

This Microsoft Visual Basic/Visual Basic for Applications (VBA) example sets two global variables to reflect the values in controls on a form and then sets a global variable representing the Dirty property to False.

Private Sub PropertyPage_Apply()
    globWorkGroup = Form1.Text1.Text
    globUserType = Form1.Combo1.Text
    globDirty = False
End Sub
		

The following Visual Basic for Applications (VBA) example creates a new view called New Table and applies it.

Sub CreateView()
'Creates a new view

    Dim olApp As Outlook.Application
    Dim objName As Outlook.NameSpace
    Dim objViews As Outlook.Views
    Dim objNewView As Outlook.View

    Set olApp = New Outlook.Application
    Set objName = olApp.GetNamespace("MAPI")
    Set objViews = objName.GetDefaultFolder(olFolderInbox).Views
    Set objNewView = objViews.Add(Name:="New Table", _
                     ViewType:=olTableView)
    objNewView.Save
    objNewView.Apply

End Sub