Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How Can I allow user's to create their own keyboard shortcuts to a macro that is inside a locked vba project? I do not want to allow access to the vba project, but not everyone is happy to use the preset shortcut.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    How about this. Change the macro (named Macro1 in the code) as appropriate:

    Code:
    Option Explicit
    Sub ChangeShortCutKey()
      Dim sKey As String
      sKey = InputBox(Prompt:="Type Shortcut key", _
    	Title:="Enter Shortcut key")
      sKey = Left(sKey, 1)
      If sKey = "" Then
    	MsgBox "Nothing entered"
      Else
    	Application.MacroOptions _
    	  Macro:="Macro1", _
    	  ShortcutKey:=sKey
      End If
    End Sub
    Steve

  3. #3
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Steve,
    Thankyou very much, I was not expecting that to be so easy! Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •