OL2002: How to Resize a Custom Form When It Is Opened (291418)



The information in this article applies to:

  • Microsoft Outlook 2002

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: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: 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 "explorers" in the object model) or item windows ("inspectors").

To create a custom contact form that displays at a specific location when opened, follow these steps:
  1. Open a new contact.
  2. On the Tools menu, point to Forms, and then click Design This Form.
  3. 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
    					
  4. 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.
  5. 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.

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:

287530 OL2002: Questions About Custom Forms and Outlook Solutions


Modification Type:MajorLast Reviewed:6/23/2005
Keywords:kbhowto KB291418