S
Sprinks
I am attempting to set custom hotkey assignments by reading their values from
the user's column in a table:
UserName Sprinks Bob Default
MacroName
MacroA a b b
MacroB b a
If no value is listed, as in Default's MacroB, I would like to remove any
pre-existing hotkey assignment. The following code, however, is not working.
It shows the MsgBox statement but does not remove the hotkey assignment.
Can anyone explain what I'm doing wrong?
Thank you.
Sprinks
' If username or "DEFAULT" found, then assign macro hot keys
If intUserColumn <> 0 Then
inti = 4 ' First row of macro names
Do
strMacroName = Cells(inti, 1)
strKey = fstrHotKey(Cells(inti, intUserColumn))
' fstrHotKey returns either the left-most letter or a blank string
If strKey = "" Then
' No or bad assignment; remove hotkey
MsgBox "Will remove hotkey for " & strMacroName
Application.MacroOptions Macro:=strMacroName,
HasShortcutKey:=False
Else
' Assign hotkey
Application.MacroOptions Macro:=strMacroName,
ShortcutKey:=strKey
End If
inti = inti + 1
Loop Until Cells(inti, 1) = ""
End If
the user's column in a table:
UserName Sprinks Bob Default
MacroName
MacroA a b b
MacroB b a
If no value is listed, as in Default's MacroB, I would like to remove any
pre-existing hotkey assignment. The following code, however, is not working.
It shows the MsgBox statement but does not remove the hotkey assignment.
Can anyone explain what I'm doing wrong?
Thank you.
Sprinks
' If username or "DEFAULT" found, then assign macro hot keys
If intUserColumn <> 0 Then
inti = 4 ' First row of macro names
Do
strMacroName = Cells(inti, 1)
strKey = fstrHotKey(Cells(inti, intUserColumn))
' fstrHotKey returns either the left-most letter or a blank string
If strKey = "" Then
' No or bad assignment; remove hotkey
MsgBox "Will remove hotkey for " & strMacroName
Application.MacroOptions Macro:=strMacroName,
HasShortcutKey:=False
Else
' Assign hotkey
Application.MacroOptions Macro:=strMacroName,
ShortcutKey:=strKey
End If
inti = inti + 1
Loop Until Cells(inti, 1) = ""
End If