Microsoft KB Archive/291418

= OL2002: How to Resize a Custom Form When It Is Opened =

Article ID: 291418

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q291418





SUMMARY
This article describes how you can create a custom Outlook form that positions itself in a specific location on the screen.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

The Outlook 2000 and Outlook 2002 object models include support for positioning and sizing Outlook windows on the screen. This feature can be used with either folder windows (known as &quot;explorers&quot; in the object model) or item windows (&quot;inspectors&quot;).

To create a custom contact form that displays at a specific location when opened, follow these steps:  Open a new contact. On the Tools menu, point to Forms, and then click Design This Form.  On the Form menu, click View Code. Enter the following Visual Basic Scripting Edition (VBScript) code into the Script Editor, and then close the Script Editor: Sub Item_Open Set objInspector = Item.GetInspector objInspector.Left = 0 objInspector.Width = 400 objInspector.Top = 0 objInspector.Height = 400 Set objInspector = Nothing End Sub  On the Tools menu, point to Forms, and then click Publish Form. The default is to store the contact form in your Contacts folder. Type Resize Test as the Display Name, and then click Publish. Close and do not save changes to the form.

To test the form, on the Actions menu, click New Resize Test.

Design Considerations

 * If you have the Windows taskbar docked on the left or top of the screen, setting the Left or Top properties of the Outlook window to zero (0), causes the window to appear under the taskbar.
 * The Outlook object model does not provide support for determining the screen resolution used on a particular computer so you can adjust the form size. If you are programming in an environment that allows access to Windows APIs, then you can access APIs to retrieve this information. Or, if you are programming in VBScript, another approach would be to automate another Microsoft Office application, such as Microsoft Word, to access the System object and use its VerticalResolution and HorizontalResolution properties.

<div class="references_section">