getElementsByClassName
returns a collection. If no element can be found a collection with no items is returned. But it is still a collection object so that checking for
Nothing
will always fail. Instead check if the collection is empty or not by using the
Count
property:
Set element = appIE.document.getElementsByClassName("alert-block")
If element.Count > 0
Endif