how do i #include?

E

emory.smith

hi,

hope this is the right place for my question.

i am creating a template file for msword that is loaded at startup an
contains a procedure that loads a number of keybindings into the norma
template.

Code
-------------------
Private Sub SetupKeyBindings()

CustomizationContext = NormalTemplate
KeyBindings.ClearAll

KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyA), KeyCategory:=wdKeyCategoryCommand, Command:="StartOfLine"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyE), KeyCategory:=wdKeyCategoryCommand, Command:="EndOfLine"
..
-------------------

the problem is that i would like to be able to change and add/remov
the "keybindings.add" statements without having to open up the ".dot
file and edit macros.

im looking for a way to do any of the following (in order o
preference):
- open and parse a separate xml or text file containing entries o
the form <keycode> <keycatagory> <command> and dynamically generat
each "keybindings.add" statement from a line of the input file
- just put all the "keybindings.add" statements in another file an
insert that file inline into the sub procedure (like using #includ
in c)
- edit the macros in a .dot with a regular editor (ie - withou
opening microsoft word)

im sure that these are all quite easy to do if vba is like any othe
language, but im just learning it (mostly from recording and editin
macros) and havent found any good reference yet (anyone recommend an
good ones?)
 
J

Jezebel

VBA has no #Include function, but there's no problem simply reading a text
file. Check Help on VBAs Open/Input/Close functions.



emory.smith said:
hi,

hope this is the right place for my question.

i am creating a template file for msword that is loaded at startup and
contains a procedure that loads a number of keybindings into the normal
template.

Code:
--------------------
Private Sub SetupKeyBindings()

CustomizationContext = NormalTemplate
KeyBindings.ClearAll

KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyA),
KeyCategory:=wdKeyCategoryCommand, Command:="StartOfLine"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyE),
KeyCategory:=wdKeyCategoryCommand, Command:="EndOfLine"
 

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