Greg Truby
MrExcel MVP
- Joined
- Jun 19, 2002
- Messages
- 10,030
I just thought I'd throw this up in a post since recently had a nice session with this and I did a quick search here and don't see any threads that appear to warn of this. It's not likely to happen too often, but it's a bit of a pain in the tuckus when it does. (If you're not familiar with the whole ProtectedViewWindow object - it's what you get when you open an attachment from Outlook 2010.)
Code:
'// if only a protected view and nothing else, then one cannot
'// access the statusbar, if the active window is a PV then
'// activeworkbook is nothing; so use that as the test.
#If VBA7 Then
With Application
If .StatusBar <> False Then
If Not .ActiveWorkbook Is Nothing _
Or (.ActiveWorkbook Is Nothing _
And .ProtectedViewWindows.Count = 0) Then
.StatusBar = False
End If
End If
End With
#Else
Application.StatusBar = False
#End If
Last edited: