VB and VBA Users Source Code: Check to see if a form is loaded
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Check to see if a form is loaded
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Tuesday, March 20, 2001
Hits:
856
Category:
Windows Forms/GUI/Controls/Graphics
Article:
The following functions can be used to determine if a form has been loaded into memory. Option Explicit '--------------------VBA Version----------------------- 'Purpose : Determines if a form is loaded into memory. 'Inputs : sFormName The name of the form to check. Note, this is not ' the form caption but the "name" property of the ' form eg. Me.Name 'Outputs : Returns True if the form is currently loaded. 'Author : Andrew Baker 'Date : 03/09/2000 13:58 'Notes : VBA Only 'Revisions : Function FormLoadedVBA(sFormName As String) As Boolean Dim lForm As Long For lForm = 0 To UserForms.Count - 1 If UserForms(lForm).Name = sFormName Then FormLoadedVBA = True Exit For End If Next End Function '--------------------VB Version----------------------- Option Explicit 'Purpose : Determines if a form is loaded into memory. 'Inputs : sFormName The name of the form to check. Note, this is not ' the form caption but the "name" property of the ' form eg. Me.Name 'Outputs : Returns True if the form is currently loaded. 'Author : Andrew Baker 'Date : 03/09/2000 13:58 'Notes : VB Only 'Revisions : Function FormLoadedVB(sFormName As String) As Boolean Dim lForm As Long For lForm = 0 To VB.Forms.Count - 1 If VB.Forms(lForm).Name = sFormName Then FormLoadedVB = True Exit For End If Next End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder