问题
I'm doing some VBA recently for work and I need to check in a webpage to click a button if is enable and don't click if is disabled.
BUT! I don't know how to make VBA check the disabled button.
Here is the button code:
<input name="formAction:proxima" title=">" disabled="disabled" class="button" id="FormAction:proxima" type="submite" value=">">
I tried some If, but didn't work
Set nxt = IE.document.getElementById("formAction:proxima")
If nxt Is Nothing Then
IE.Quit
Else
nxt.Click
End If
回答1:
You can also use the .disabled
property (Boolean).
Dim nxt As HTMLButtonElement
Set nxt = IE.document.getElementById("formAction:proxima")
If nxt.disabled Then
ie.Quit
Else
nxt.Click
End If
回答2:
You need to access the button disabled
property. Try this:
Set nxt = IE.document.getElementById("formAction:proxima")
If nxt.getAttribute("disabled") = "disabled" Then
IE.Quit
Else
nxt.Click
End If
来源:https://stackoverflow.com/questions/49330011/determining-if-html-button-is-disabled-in-ie