property ExPrint.hWnd as Long
Retrieves the handle of the print preview main frame.

TypeDescription
Long A long expression that indicates the window handle of the print preview main frame.

Use the hWnd property to get the window handle of the print preview main frame. Use the hWnd property to verify whether the print preview main frame is visible or hidden. The following sample displays the print preview main frame if it is hidden, it closes the print preview main frame if it is visible:

Private Sub Command1_Click()
    With Print1
    If .hWnd = 0 Then
        Set .PrintExt = Me
        .Preview
    Else
        Set .PrintExt = Nothing
    End If
    End With
End Sub