Resize a control horizontally and vertically with the form

Microsoft Office Outlook 2003

Show All Show All

Resize a control horizontally and vertically with the form

This procedure sets an invisible property. After you complete the procedure, you should remove the code from the Script Editor.

  1. In design mode, select the control, and then size it relative to the form. For example, if you want the control to always be same as the height of the form, make the bottom edge of the control equal to the bottom edge of the form.

  2. On the Form menu, click View Code.

  3. Add the following code to the Script Editor. Replace "TextBox1" with the name of the control you want to resize, and replace "P. 2" with the name of your page. Although this example uses the Write event, you can use any event to run the code.

    Sub Item_Write

    Item.GetInspector.ModifiedFormPages("P.2").TextBox1.LayoutFlags = 65

    End Sub

  4. On the Form menu of the form, click Run This Form.

  5. On the File menu of the form, click Save.

Note  To reset the LayoutFlags property, right-click the control, and then click Properties on the shortcut menu. On the Display page, if the Resize with form check box is selected, clear it; if the Resize with form check box is cleared, select it and then clear it.