Working with the Screen Object
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
Related examples in the same category