VBA/Excel/Access/Word/Language Basics/ActiveForm

Материал из VB Эксперт
Перейти к: навигация, поиск

Working with the Screen Object

   <source lang="vb">

Sub screen()

   On Error Resume Next
   
   Dim strName As String
   Dim strType As String
   strType = "Form"
   strName = ActiveForm.Name
   If Err = 2475 Then
   
       Err = 0
       strType = "Report"
       strName = ActiveReport.Name
       If Err = 2476 Then
           Err = 0
           strType = "Data access page"
           strName = ActiveDataAccessPage.Name
           If Err = 2022 Then
               Err = 0
               strType = "Datasheet"
               strName = ActiveDatasheet.Name
           End If
       End If
   End If
   Debug.Print "The current Screen object is a " & strType & "Screen object name: " & strName

End Sub

</source>