Tim was telling us:
Tim nous racontait que :
> When I try to add keybindings to Alt+C and Alt+N, I get a Run-time
> error '5346'.
[quoted text clipped - 9 lines]
> What is Alt+C & Alt+N suppose to do?
> Is there a way around it?
I think the problem lies with
"ToolBarMenu.InsertCautionBP"
Word cannot recognize this, hence it cannot create the bind the key
combination. Is ToolBarMenu the name of a module, a sub, a project...
IIRC, ALT+C and ALT+N are not assigned to anything, so it should not be a
problem to bind anything you want to them.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Tim - 17 Nov 2004 14:19 GMT
Thanks, you are correct. The problem does lie within
"ToolBarMenu.InsertCautionBP". ToolBarMenu is a module and
InsertCautionBP is a procedure. The problem is that
this procedure is expecting a argument.
Thanks for the Help.
Tim
> Tim was telling us:
> Tim nous racontait que :
[quoted text clipped - 19 lines]
> IIRC, ALT+C and ALT+N are not assigned to anything, so it should not be a
> problem to bind anything you want to them.
Jonathan West - 17 Nov 2004 16:48 GMT
> Thanks, you are correct. The problem does lie within
> "ToolBarMenu.InsertCautionBP". ToolBarMenu is a module and
> InsertCautionBP is a procedure. The problem is that
> this procedure is expecting a argument.
>
> Thanks for the Help.
Hi Tim,
The OnAction property can only be set to a VBA routine which meets all the
following conditions
- A public Sub
- In a module (as opposed to a Class for UserForm)
- with no parameters
If you want to be able to pass a paramater to a from the button, it can be
done, but it is a bit convoluted.
Every Commandbutton has a Tag property. You can't set the Tag from within
the user interface, but you can in code. Suppose you have set the tag, you
can then do something like this
Dim strTag as Tag
If CommandBars.ActionControl Is Nothing Then
'not called from a button
MsgBox "the macro wasn't called by clicking a toolbar button"
Exit
Else
strTag = CommandBars.ActionControl.Tag
End If
'Now you can use the value of strTag in your macro

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Jean-Guy Marcil - 17 Nov 2004 17:16 GMT
Jonathan West was telling us:
Jonathan West nous racontait que :
> Hi Tim,
>
[quoted text clipped - 21 lines]
> End If
> 'Now you can use the value of strTag in your macro
Sorry Jonathan, just to be sure I did not miss something here...
The OP was writing about KeyBinding to a macro... Aren't OnAction property
for commandbar controls?
How do you make the connection to a keyboard shortcut?

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org