I'm using VBA with Microsoft Access.
I'm setting an object to an item inside a WebBrowserControl that sometimes exists, sometimes doesn't.
Dim myWebBrowser As Object
Dim myItemInsideWebpage As Object
Set myWebBrowser = Me.WebBrowser0.Object
Set myItemInsideWebpage = myWebBrowser.Document.GetElemendById("myDiv")
If 'myDiv' exists, awesome, if not I want Access to let me know so I can deal with it.
I believe it would be something like
If myItemInsideWebpage Is Nothing Then
' doesn't exist
Else
' does exist
End If
You may need to preface your 'Set' statement with 'On Error Resume Next' in case an error is thrown when 'myDiv' does not exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With