zelarra821
Registered User.
- Local time
- Today, 23:19
- Joined
- Jan 14, 2019
- Messages
- 834
Hello. I have a custom ribbon in which I add a procedure created by me (with your invaluable help, thanks). I want to know if it is possible to add a keyboard shortcut to it, and where and how it would be done.
Thanks a lot.
Thanks a lot.
Code:
<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="T001" label="Formato de texto">
<group idMso="GroupTextFormatting">
</group>
<group id="PegadoEspecial" label="Pegado especial">
<button id="PegarTextoSinFormato" label="Pegar texto sin formato" imageMso="Paste" size="large" supertip="Pegar texto sin formato" onAction="rbPegarSinFormato" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Code:
Sub rbPegarSinFormato(Control As IRibbonControl)
If (Screen.ActiveControl & "") = "" Then
Screen.ActiveControl = Application.PlainText(Clipboard)
Else
Screen.ActiveControl = Application.HtmlEncode(Application.PlainText(Screen.ActiveControl & "<br>" & Clipboard))
End If
Dim ctrl As Access.Control
Set ctrl = Screen.ActiveControl
ctrl.SelStart = Len(ctrl.Text)
End Sub