OlkControl Class

Outlook Developer Reference

Defines a set of control properties common to some Microsoft Office Outlook controls.

Version Information
 Version Added:  Outlook 2007

Remarks

The members offered by OlkControl can apply to most Outlook controls. OlkControl provides a class to which you can conveniently cast an Outlook control without resorting to reflection. Although OlkControl does not apply to Microsoft Forms 2.0 controls, similar properties are available to Forms 2.0 controls. For more information, see KB 180972: Additional Control Properties Available for Programming.

Example

The following code sample uses the OlkControl class to enable automatic resizing of a text box control with respect to any resizing of the form. It uses casting in Visual Basic to allow the text box control to use the properties of OlkControl.

Visual Basic Scripting Edition
  Sub ResizeWithForm()
    Dim myTextBox As OlkTextBox
    Dim olkCtrl As OlkControl
' Let the text box control use the properties of OlkControl
Set olkCtrl = myTextBox

' Enable automatic adjustments of the layout with respect to the rest of the form
olkCtrl.EnableAutoLayout = True

' Allow resizing the text box control horizontally and vertically with the form
olkCtrl.HorizontalLayout = olHorizontalLayoutGrow
olkCtrl.VerticalLayout = olVerticalLayoutGrow

End Sub

See Also