dcsimg
Results 1 to 2 of 2

Thread: Word Add-in with shortcut key causing Alt menu to appear

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2014
    Posts
    33

    Word Add-in with shortcut key causing Alt menu to appear

    I've created a Word Add-in that creates a global hotkey so that while the form is open (doesn't have to have focus) it will insert text into Microsoft Word. I've got it working and doing what it needs to be doing but I'm struggling with a little nuance with the Alt menu that pops up on the toolbar as shown below:

    Name:  Capture.jpg
Views: 150
Size:  14.3 KB

    Now while I'm using this shortcut key (Alt+V), I want to be able to just seamlessly continue to type without this menu popping up and accidentally activating one of those built-in shortcuts. I noticed that while typing, if I used Alt+V, I would by default just hit the escape key or tap the alt key to remove it again before continuing on with typing. Of course this is far from efficient. So I tried the following:

    Code:
        Public Shared Sub handleHotKeyEvent(ByVal hotkeyID As IntPtr)
    
                _PST("Colloquy", sJuror)  'Inserts the value of sJuror into Word using the style "Colloquy"
                Sendkeys.Send("{ESC}")
            End If
    
        End Sub
    This just caused Word to lose focus. So I tried inserting oWord.Activate() after sending the escape key but found that the menu was still displaying itself.

    Any suggestions would be appreciated. If any further clarification is required please let me know what other information you may need. TYIA.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,941

    Re: Word Add-in with shortcut key causing Alt menu to appear

    In that case, i'd change the global hotkey combination. It'd be a lot easier than trying to find a workaround to fix your side-effects...

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width