How to assign shortcut key to builtin style in MS Word 2010 using RRS feed

  • Question

  • I have written code for Application level MS Word Addin according to my own requirement for built in headings now i want to assign shortcut key to them. Following is the code. While using word this can be achieved by clicking on a style i.e Heading 1-> modify->shortcut key


    With oDoc.Styles(word.WdBuiltinStyle.wdStyleHeading1)
                .Font.Bold = False
                .Font.Size = 12
                .Font.Name = "Arial"
                .Font.Spacing = 16
                .NameLocal = "Heading1"
                .BaseStyle = "Normal"
                .ParagraphFormat.SpaceBefore = 6
                .ParagraphFormat.OutlineLevel = 1
                With .ParagraphFormat.TabStops
                    .Add(Position:=oWord.CentimetersToPoints(2), Alignment:=word.WdAlignmentTabAlignment.wdCenter)
                End With
                .ParagraphFormat.KeepWithNext = True
            End With


    Please guide how assign shortcut keys using code.

    Monday, March 23, 2015 5:51 PM


  • I achieved my objective using the following technique shared by @theduck

    KeyBindings.Add wdKeyCategoryStyle, "Heading 1", BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyH)
    binds Heading 1 to the Ctrl-Alt-H key combination.

    Monday, March 30, 2015 11:34 AM

All replies