Hi,
I've created a PowerPoint addin that allows me to manipulate shapes using a new toolbar with buttons connected to various macros. When I install the addin, PowerPoint automatically assigns keystroke accelerators to the buttons I created on the new addin toolbar...[Alt, X, Y1]....[Alt, X, Y2]...etc. Is it possible to change these default accelerators to for example...[Alt, X, R, R]... using VBA such that when I update the addin code and re-install the addin on multiple computers, the accelerators will be whatever I define them as? The code I am using for my new toolbar (copied from a forum and tweaked for my purpose) is below and I am working in PowerPoint 2016. Just in case it isn't immediately obvious, I'm a complete noob so feel free to suggest improvements to the below if necessary.
[ATTACH=CONFIG]73864[/ATTACH]
Sub Auto_Open()
Dim oToolbar As CommandBar
Dim oButton As CommandBarButton
Dim MyToolbar As String
MyToolbar = "Shape Manipulator"
On Error Resume Next
Set oToolbar = CommandBars.Add(Name:=MyToolbar, _
Position:=msoBarFloating, Temporary:=True)
If Err.Number <> 0 Then
Exit Sub
End If
On Error GoTo ErrorHandler
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Pick Up Shape Attributes"
.Caption = "Pick Up Attributes"
.OnAction = "CopySizeAndPosition"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 351
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Paste Shape Attributes"
.Caption = "Paste Attributes"
.OnAction = "PasteSizeAndPosition"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 352
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Stretch Left"
.Caption = "Stretch Left"
.OnAction = "StretchLeft"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 132
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Stretch Right"
.Caption = "Stretch Right"
.OnAction = "StretchRight"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 133
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Stretch Up"
.Caption = "Stretch Up"
.OnAction = "StretchUp"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 134
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Stretch Down"
.Caption = "Stretch Down"
.OnAction = "StretchDown"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 135
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Stretch Vertically"
.Caption = "Stretch Vertically"
.OnAction = "StretchVertically"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 1147
End With
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "Stretch Horizontally"
.Caption = "Stretch Horizontally"
.OnAction = "StretchHorizontally"
.Style = msoButtonIconAndCaptionBelow
.FaceId = 1146
End With
oToolbar.Top = 150
oToolbar.Left = 150
oToolbar.Visible = True
NormalExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & vbCrLf & Err.Description
Resume NormalExit:
End Sub
Display More