View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Setting Macro Hotkeys Programmatically

you can try something like this. paste this in a general module. it runs when
the workbook is opened. and assigns the letter to run the macro called test.
it uses the windows log in name.
change test to your macro name
choose your shortcut keys carefully

Sub auto_open()
Dim skey1 As String
Select Case UCase(Environ("username"))
Case "SPRINKS"
skey1 = "a"
Case "GARYK"
skey1 = "b"
Case Else
skey1 = "c"
End Select
Application.MacroOptions Macro:="test", ShortcutKey:=skey1
End Sub

--


Gary


"Sprinks" wrote in message
...
I've created a library of macros for our small workgroup. All are available
from a custom menu which loads as Excel loads based on some John Walkenbach
routines. I maintain the file on a local drive, post changes to a shared
network folder, and users use a desktop shortcut to copy the new file to
their auto-load folder.

The principal of our firm, however, prefers a different hotkey assignment
than the rest of us. To avoid having him to customize his configuration each
time, I began maintaining two different versions of the macro file. This
has, predictably, become more of a maintenance headache than I want to
have--life's too short.

Can someone tell me how I can read the username on file load and configure
hotkey assignments based on each user? I figured that I would use a table on
a hidden worksheet to store each user's preferences, as well as a default
configuration.

Thank you for any assistance.
Sprinks