Demonstration of Window size Properties
Sub GetWindowInfo()
Dim lState As Long
Dim sInfo As String
Dim lResponse As Long
' Prepare message to be displayed
sInfo = sInfo & "Usable Height = " & Application.UsableHeight & vbCrLf
sInfo = sInfo & "Usable Width = " & Application.UsableWidth & vbCrLf
sInfo = sInfo & "Height = " & Application.Height & vbCrLf
sInfo = sInfo & "Width = " & Application.Width & vbCrLf & vbCrLf
lResponse = MsgBox(sInfo, vbYesNo, "Window Info")
' Minimize window if user clicked Yes
If lResponse = vbYes Then
Application.WindowState = xlMinimized
End If
End Sub
Related examples in the same category