none
HOTKEYS!!! RRS feed

  • Question

  • I currently have my hotkey working by setting a macro to run when pressing F^. I did this by using the hotkey option in "record Macro" then not recording anything and putting in a line o focde that is like "userform.show" which successfully birings up my form. This is not the best way

    Havent found anythign helpful yet so is there a few line of code i can add that will open a userform for display when i hit F6 (i also need to create one that will com eup when pressing Ctrl+y

    Friday, July 29, 2011 7:18 PM

Answers

  • Creating a macro that shows the userform and assigning a keyboard shortcut to it is the only way. But you do not have to start by recording a macro (although that is a convenient method). You can also write the macro code directly:

    Press Alt+F11 to activate the Visual Basic Editor.

    On the left hand side, click on the document or template that contains the userform.

    Select Insert | Module.

    Type the three-line macro:

    Sub StartFormOne()
      FormOne.Show
    End Sub
    

    You can add more macros like this if desired.

    Switch back to Word.

    In Word 2003 or before, select Tools | Customize..., then click Keyboard...

    In Word 2007, click the Office button, then Word Options. Click Quick Access Toolbar, then Customize... next to Keyboard shortcuts.

    In Word 2010, click File, then Options. Click Customize Ribbon, then then Customize... next to Keyboard shortcuts.

    Select where you want to store the keyboard shortcut in the Save changes in dropdown.

    Select Macros in the list of Categories on the left, then one of the macros that you created in the list of Commands on the right.

    Click in the Press new shortcut key box.

    Press the desired keyboard shortcut, then click Assign.

    Click Close, then OK.


    Regards, Hans Vogelaar
    Friday, July 29, 2011 7:57 PM
  • Thanks Hans for your correct answer.

    Hi CTroend,

    You can assign a shortcut key for your macro as Hans said, additionally, for more information about this, please refer to:

    http://msdn.microsoft.com/en-us/library/ff604039.aspx

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 4, 2011 7:48 AM
    Moderator

All replies

  • Creating a macro that shows the userform and assigning a keyboard shortcut to it is the only way. But you do not have to start by recording a macro (although that is a convenient method). You can also write the macro code directly:

    Press Alt+F11 to activate the Visual Basic Editor.

    On the left hand side, click on the document or template that contains the userform.

    Select Insert | Module.

    Type the three-line macro:

    Sub StartFormOne()
      FormOne.Show
    End Sub
    

    You can add more macros like this if desired.

    Switch back to Word.

    In Word 2003 or before, select Tools | Customize..., then click Keyboard...

    In Word 2007, click the Office button, then Word Options. Click Quick Access Toolbar, then Customize... next to Keyboard shortcuts.

    In Word 2010, click File, then Options. Click Customize Ribbon, then then Customize... next to Keyboard shortcuts.

    Select where you want to store the keyboard shortcut in the Save changes in dropdown.

    Select Macros in the list of Categories on the left, then one of the macros that you created in the list of Commands on the right.

    Click in the Press new shortcut key box.

    Press the desired keyboard shortcut, then click Assign.

    Click Close, then OK.


    Regards, Hans Vogelaar
    Friday, July 29, 2011 7:57 PM
  • Thanks Hans for your correct answer.

    Hi CTroend,

    You can assign a shortcut key for your macro as Hans said, additionally, for more information about this, please refer to:

    http://msdn.microsoft.com/en-us/library/ff604039.aspx

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 4, 2011 7:48 AM
    Moderator