Ask Your Question
0

Macro - detecting if shift, ctrl & alt is pressed while clicking a toolbar button

asked 2017-08-28 12:45:55 +0200

Kunjomachen gravatar image

updated 2017-08-28 12:48:26 +0200

Is it possible in LibreOffice such that a toolbar button for a macro can detect if the user is pressing modifiers as he clicks the button?

Can the toolbar button run other functions with the combination of shift, ctrl & alt is pressed while clicking?

Example:

click- toolbar button runs function A,

shift+click - same toolbar button runs function B,

ctrl+click -same toolbar button runs function C

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-08-28 13:15:00 +0200

JohnSUN gravatar image

Just create simple test like as this:

Sub tstRunEvent(oEvent As Variant)
Dim sMsg As String 
    Select Case oEvent
        Case 0
            sMsg = "Simple"
        Case 4096
            sMsg = "Shift"
        Case 8192
            sMsg = "Ctrl"
        Case 12288
            sMsg = "Ctrl+Shift"
        Case Else
            sMsg = "O_O What do you "
    End Select
    MsgBox(sMsg + " click (" + oEvent + ")", 48, "Modifiers")
End Sub

Apply it to button in user-defined toolbar and test it

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-08-28 12:45:55 +0200

Seen: 32 times

Last updated: Aug 28 '17