VBA code to create an 'onmouseup' action over and html object?

larryjfoster

New Member
Joined
Jul 19, 2017
Messages
20
So it looks like the below code requires a mouse event to fire activity. Is it possible to replace a .click function with something that would function as an .onmouseup function

HTML:
<span class="timeClockButtonContainer">
                            <span data-dojo-type="dijit/_Widget" data-dojo-attach-point="ShiftStartBtn" data-dojo-attach-event="onMouseUp: _onShiftStartMouseUp " data-dojo-props="className: at('rel:', 'shiftStartDisabled').direction(at.from).transform(transformers.ShiftStartClass)" id="dijit__Widget_19" lang="en-us" widgetid="dijit__Widget_19" class="timeClockButton ShiftStartNormal ">
                            </span>
                            <span data-dojo-type="Framework/UI/mvc/Output" data-dojo-props="value: localize('lblESSShiftStartButton'), className: at('rel:', 'shiftStartDisabled').direction(at.from).transform(transformers.ButtonClass)" class="ClockButtonTextEnabled" id="Output_39" lang="en-us" widgetid="Output_39">In</span>
                        </span>

The below code does not return any errors though it does not do the 'FireEvent' either...
VBA Code:
Dim colNodes As Object
Dim objNode As Object
Dim strTarget As String

strTarget = "ShiftStartBtn"

'Click Clock In Button
Set colNodes = IE.document.getElementsByClassName("timeClockButtonContainer")
For Each objNode In colNodes
    If objNode.getAttribute("data-dojo-attach-point") = strTarget Then Exit For
Next
If Not objNode Is Nothing Then
    Debug.Print objNode.innerText
    objNode.FireEvent "onmouseup"
End If
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Maybe this:
VBA Code:
    Dim mouseUpEvent As Object 'DOMMouseEvent

    'After IE.document is loaded...
    Set mouseUpEvent = IE.document.createEvent("MouseEvent")
    mouseUpEvent.initEvent "mouseup", True, False
    objNode.dispatchEvent mouseUpEvent
 
Upvote 0
Maybe this:
VBA Code:
    Dim mouseUpEvent As Object 'DOMMouseEvent

    'After IE.document is loaded...
    Set mouseUpEvent = IE.document.createEvent("MouseEvent")
    mouseUpEvent.initEvent "mouseup", True, False
    objNode.dispatchEvent mouseUpEvent
Hi John, thank you for the effort but I get the same result. It runs through the sub routine without issue but does not trigger the "data-dojo-attach-event="onMouseUp: _onShiftStartMouseUp"
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top