Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Australia
    Posts
    245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Key Assignment failure (VBA/Word/97 & 2000)

    Advice is required to solve a problem I am experiencing with key assignments in MS Word.

    The scenario is a template with a number of macros stored in C:Program FilesMicrosoft OfficeOfficeStartup. These macros are run either from a custom toolbar button or a key assigment. One key assignment (Alt+Z) will sometimes not work and a printout of the key assignments indicates the following against its name "The macro named TEMPLATEPROJECT.NEWMACROS.MACRO1 does not exist."

    But, open the template and go to the VBE and a single step through the code does work. Also a re-assignment of the keyboard shortcut indicates that it is still assigned (but I know it does not work) and when I rebuilt the template by exporting every module and macro then importing them back into a new document and re-assigning the keyboard shortcut for the macro ((Alt+Z, same as previous) it works initially but will give up without any particular action on the part of the user or me.

    All suggestions will be greatly appreciated as I am perplexed as to why it should happen.

    Are there any differences between the Startup folder usage for WinNT/Word 97 and Win2000/Word 2000 that I am missing?

    Thanks, Leigh

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key Assignment failure (VBA/Word/97 & 2000)

    i'm not sure, but you could try to recreate the template with a different (and unique) project name.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Key Assignment failure (VBA/Word/97 & 2000)

    I can't remember the syntax for key assignments. Does it force you to refer to a particular template? If not, it probably relies on the CustomizationContext setting for where to store it. If you look that up in the online help, it might, uh, help. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Here's something from the past that shows sort of what I mean:
    <hr>Subject: Re: stop tab from creating rows (2000) [#210057]
    Poster: StuartR
    Posted on: 02-Jan-03 22:00

    Using Klaus Linke's code from post 114359 we could create a pair of Macros like.

    <pre>Public Sub TabToNextFormField()
    Selection.GoTo What:=wdGoToField, Which:=wdGoToNext
    End Sub

    Sub SetKeyBindings()
    <span style="background-color: #FFFF00; color: #000000; font-weight: bold">CustomizationContext = NormalTemplate</span hi>
    KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, _
    Command:="TabToNextFormField", _
    KeyCode:=wdKeyTab
    End Sub</pre>

    Execute SetKeyBindings once to assign the Macro to the Tab key
    You may need to change the NormalTemplate in the second one to point to somewhere different (e.g. ActiveDocument.Template)
    You could modify the TabToFormField macro so that it changes its behaviour depending on whether the selection is in a table.<hr>
    Hope this helps.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Australia
    Posts
    245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Key Assignment failure (VBA/Word/97 & 2000)

    Thanks Pieter and Jefferson for your replies.

    Firstly, something very strange happened before the following steps were taken. A key assignment (the wretched Alt+Z combo) decided to re-assign itself to another of the 17 modules (BTW, there are also 13 userforms!!). I had never had this problem before.

    Now I have looked at both suggestions after printing all the key assignments and deleted all those key assignments in the opened template:

    <pre> Tools | Customize... | Keyboard... | Reset all...</pre>

    Then, for good measure I renamed the offending module and tested the key assignments in a new document (they didn't exist, so that was easy!). Nothing untoward so far.

    Next step was to assign new key assignments to each of the relevant modules and test them. For good measure I also recreated the Alt+Z combo and tested all of them. (There were six, three open userforms, three run a macro directly.)

    Lo and behold, Alt+Z is the only one not to work! Bizarre? So I have now taken the precaution of also assigning Alt+C (other end of the scale in case the operating system has a problem at the bottom end of the alphabet) AND given users a toolbar button if all else fails.

    Now for extended testing... throwing it to the real users. WML (Wish Me Luck <img src=/S/please.gif border=0 alt=please width=31 height=23>)

Posting Permissions

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