Dim TempForm as FormFor Each TempForm In Forms
    If TempForm.Caption="frmTest" Ten Exit For
Next TempFormIf TempForm is Nothing Then Exit Sub
TempForm就是你要找的Form

解决方案 »

  1.   

    try this::Private Sub Form_Load()
        CallForm "Form1", "Caption", VbLet, "Hello world"
    End SubPrivate Sub CallForm(ByVal sFormName As String, _
                         ByVal sProcName As String, _
                         ByVal eCallType As VbCallType, _
                                    Args As Variant)
        Dim oFRM As Form
        Dim sName As String
        
        For Each oFRM In Forms
            sName = oFRM.Name
            Debug.Print sName
            If UCase(sName) = UCase(sFormName) Then
                CallByName oFRM, sProcName, eCallType, Args
                Exit Sub
            End If
        Next
    End Sub
    Or you have to use script control I think
      

  2.   

    zyl910(910:分儿,我来了!) (L2002) :谢谢。 如此确实能找到。 Forms 对象 在运行时是动态的加入,如果在设计状态下或在没有转入(frmTest.Show [1])时。是没法找到的。而且只要一访问 frmTest.Name(Caption) 是就相当于执行了 frmTest.Show [1].