The information in this article applies to:
SYMPTOMSWhen you refer to the UserForms collection in a Visual Basic for Applications macro, you may receive one of the following error messages:
-or-
CAUSEThe UserForms collection is a collection of currently loaded UserForms; however, it does not provide its list as a property of the collection. Therefore, a statement such as UserForms(1).Show returns run-time error 9. In order to refer to an item in the UserForms collection, you must first add the UserForm list element to the UserForms collection. WORKAROUNDMicrosoft 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 the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspTo refer to a UserForm within a UserForms collection and return a property or method for the UserForm, use either of the following methods. Method 1: Create a UserForm ObjectThe following subroutine displays a UserForm that already is created.
Method 2: Refer Directly to the UserFormThe following two statements display a UserForm that already is created:UserForm1.Show -or- VBA.UserForms.Add("UserForm1").Show Method 3: Reference the Item Property (index) of the UserFormThe following subroutine displays a UserForm that already is created.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. REFERENCESFor more information about the UserForms collection, click the Index tab in Visual Basic Help, type the following text UserForms collectionand then double-click the selected text to go to the "UserForm Object, UserForms Collection" topic. Additional query words: XL97 8.00 dialogs
Keywords : kberrmsg kbprg kbdta kbdtacode xlvbainfo KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |