define keys to run Addin code

Z

zSplash

I am trying to set 2 keys on the keyboard to run code from MyAddin, on the
server. I've tried the following unsuccessfully. (See the commented-out
code for what I also tried.) How can I reference an Addin when defining a
key?

Sub setKeys()
Dim myAddin As AddIn
Set myAddin = "g:\myAddin.dot" '"myAddin.dot"
CustomizationContext=NormalTemplate
KeyBindings.add KeyCode:=BuildKeyCode(wdKeyF12), KeyCategory:= _
wdKeyCategoryMacro, Command:="time" 'myAddin.time"
CustomizationContext = NormalTemplate
KeyBindings.add KeyCode:=BuildKeyCode(wdKeyInsert), KeyCategory:= _
wdKeyCategoryMacro, Command:="Send"
End Sub

TIA
 
W

Word Heretic

G'day "zSplash" <zNOSPAMSplash@ gci.net>,

set a reference to the add-in with VBE > Tools References first...



zSplash said:
I am trying to set 2 keys on the keyboard to run code from MyAddin, on the
server. I've tried the following unsuccessfully. (See the commented-out
code for what I also tried.) How can I reference an Addin when defining a
key?

Sub setKeys()
Dim myAddin As AddIn
Set myAddin = "g:\myAddin.dot" '"myAddin.dot"
CustomizationContext=NormalTemplate
KeyBindings.add KeyCode:=BuildKeyCode(wdKeyF12), KeyCategory:= _
wdKeyCategoryMacro, Command:="time" 'myAddin.time"
CustomizationContext = NormalTemplate
KeyBindings.add KeyCode:=BuildKeyCode(wdKeyInsert), KeyCategory:= _
wdKeyCategoryMacro, Command:="Send"
End Sub

TIA

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
Z

zSplash

Thanks, wHeretic. I tried setting a reference to it (using Browse), but
only library files are shown. I guess my question now is: Am I supposed to
be saving my Addin (now a .dot file) as a .olb (or some libary extension)?
If so, how to do that?

st.
 
S

Steve Hudson

G'day "zSplash" <zNOSPAMSplash@ gci.net>,

is this still outstanding? Sorry for the delay - silly season, moved
house & ISPs etc.


zSplash said:
Thanks, wHeretic. I tried setting a reference to it (using Browse), but
only library files are shown. I guess my question now is: Am I supposed to
be saving my Addin (now a .dot file) as a .olb (or some libary extension)?
If so, how to do that?

st.

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top