none
Is there a way to create a list of KEY to MACRO relationships RRS feed

  • Question

  • Hello, is there a way to create a list of the relationships between my Word macros and the keys associated with those macros?

    Thank you for any examples or pointers.

    Friday, November 4, 2011 2:11 PM

Answers

    • Marked as answer by bobk544 Friday, November 4, 2011 11:16 PM
    Friday, November 4, 2011 3:40 PM
  • Thanks again Bernie, excellent and have a nice weekend!
    bk


    • Marked as answer by bobk544 Friday, November 4, 2011 11:14 PM
    • Edited by bobk544 Friday, November 4, 2011 11:16 PM
    Friday, November 4, 2011 11:14 PM
  • yes and i was able to create this macro based on that suggestion:

    Sub keybindings()
    Open "C:\_OFTRANSFER\vba-out-key-list.txt" For Append As #1
    With Application
       c = .keybindings.Count
       MsgBox (CStr(c))
       For I = 1 To c
          cmd = .keybindings(I).Command
          cmp = .keybindings(I).KeyString
          MsgBox (cmd + " " + cmp)
          Print #1, cmp + "   " + cmd
       Next
    End With
    Close #1
    End Sub

    Ctrl+W             Normal.Module138.HliteWriteVBAOut
    Ctrl+X             Normal.Module129.CaptureLinePaste
    Ctrl+Z             Normal.Module128.CaptureLine
    Ctrl+Shift+X       Normal.Module141.CaptureLinePasteXSLT
    Ctrl+Shift+Z       Normal.Module140.CaptureLineXSLT
    Alt+Ctrl+B         Normal.Module136.BookmarkSelectionUNDRSCR
    Alt+Ctrl+Shift+F   Normal.Module64.formatdoc2
    Alt+Ctrl+Shift+I   Normal.Module40.HyperlinkSelectionToIN
    Alt+Ctrl+Shift+K   Normal.Module134.ACNTL_H_ShowKeyBoardKeys
    Alt+Ctrl+Shift+O   Normal.Module41.HyperlinkSelectionToOUT
    Alt+Ctrl+Shift+T   Normal.Module42.HyperlinkSelectionToTEMPLATE

    and thanks for your inputs on my post!

    bk

    • Marked as answer by bobk544 Saturday, November 5, 2011 12:26 PM
    Saturday, November 5, 2011 12:26 PM

All replies

    • Marked as answer by bobk544 Friday, November 4, 2011 11:16 PM
    Friday, November 4, 2011 3:40 PM
  • Thanks again Bernie, excellent and have a nice weekend!
    bk


    • Marked as answer by bobk544 Friday, November 4, 2011 11:14 PM
    • Edited by bobk544 Friday, November 4, 2011 11:16 PM
    Friday, November 4, 2011 11:14 PM
  • Ivan's solution works well for Excel shortcuts which are "behind" the bas module but I'm surprised if it will work for Word macros which I thought were stored elsewhere.

    I was amused to see my name is still listed in the credits on Ivan's page!

    Peter Thornton

    Saturday, November 5, 2011 9:48 AM
    Moderator
  • yes and i was able to create this macro based on that suggestion:

    Sub keybindings()
    Open "C:\_OFTRANSFER\vba-out-key-list.txt" For Append As #1
    With Application
       c = .keybindings.Count
       MsgBox (CStr(c))
       For I = 1 To c
          cmd = .keybindings(I).Command
          cmp = .keybindings(I).KeyString
          MsgBox (cmd + " " + cmp)
          Print #1, cmp + "   " + cmd
       Next
    End With
    Close #1
    End Sub

    Ctrl+W             Normal.Module138.HliteWriteVBAOut
    Ctrl+X             Normal.Module129.CaptureLinePaste
    Ctrl+Z             Normal.Module128.CaptureLine
    Ctrl+Shift+X       Normal.Module141.CaptureLinePasteXSLT
    Ctrl+Shift+Z       Normal.Module140.CaptureLineXSLT
    Alt+Ctrl+B         Normal.Module136.BookmarkSelectionUNDRSCR
    Alt+Ctrl+Shift+F   Normal.Module64.formatdoc2
    Alt+Ctrl+Shift+I   Normal.Module40.HyperlinkSelectionToIN
    Alt+Ctrl+Shift+K   Normal.Module134.ACNTL_H_ShowKeyBoardKeys
    Alt+Ctrl+Shift+O   Normal.Module41.HyperlinkSelectionToOUT
    Alt+Ctrl+Shift+T   Normal.Module42.HyperlinkSelectionToTEMPLATE

    and thanks for your inputs on my post!

    bk

    • Marked as answer by bobk544 Saturday, November 5, 2011 12:26 PM
    Saturday, November 5, 2011 12:26 PM
  • actually now i'm thinking of automatically configuring the keys based on the type of word docs i'm addressing ie my C# docs or my XSLT docs, for example, if i'm going to be navigating my C# docs, i could set a key to set all of the C# related keys or if i'm going to be looking at my XSLT docs i could set another key and i remember a post that will allow me to automatically set those keys, so i will get back on this a bit later, but mainly i'm now starting to create so many macros and key combos i'm totally losing track and another problem is when i'm in the vba edit screen i can only see the "Normal.Module123.." name and so i always have to go back out to the "view macros" to get the logical name and that is really throwing me off focus, so that's my next challenge, ie found out how to list the "..Module.." name with the logical name ie below "Nomal.Module134.ACNTL_H......"....ooops i just hit something and everything went bold, goind to save now, can't undo, bye bye, thanks again all!

    Ctrl+W             Normal.Module138.HliteWriteVBAOut
    Alt+Ctrl+Shift+K   Normal.Module134.ACNTL_H_ShowKeyBoardKeys

    C# DOCS:
    Ctrl+X             Normal.Module129.CaptureLinePaste
    Ctrl+Z             Normal.Module128.CaptureLine

    XSLT DOCS:
    Ctrl+Shift+X       Normal.Module141.CaptureLinePasteXSLT
    Ctrl+Shift+Z       Normal.Module140.CaptureLineXSLT

    C# DOCS:
    Alt+Ctrl+Shift+F   Normal.Module64.formatdoc2
    Alt+Ctrl+B         Normal.Module136.BookmarkSelectionUNDRSCR

    XSLT DOCS:
    Alt+Ctrl+Shift+I   Normal.Module40.HyperlinkSelectionToIN
    Alt+Ctrl+Shift+O   Normal.Module41.HyperlinkSelectionToOUT
    Alt+Ctrl+Shift+T   Normal.Module42.HyperlinkSelectionToTEMPLATE

    Saturday, November 5, 2011 1:23 PM
  • To take out the "Normal.ModuleXX." lead-in and just get the macro name, you could use

    cmd = Split(.keybindings(I).Command,".")(2)


    HTH, Bernie
    Monday, November 7, 2011 2:55 PM
  • thanks again very much Bernie, just noticed your post! have a happy holidays! bk


    rlk
    Thursday, December 22, 2011 12:26 AM