A
Alan Lambert
The context of this is a system that will allow standard
pieces of text (e.g. marketing blurb, resumes, case
studies etc.) to be inserted easily into a Word XP
document. These pieces of text will be stored in separate
files within a (flexible) folder structure.
Users will select the text files from a dropdown menu
(CommandBarPopup) on a Command Bar in Word. This menu will
be populated from the physical folder structure on a disc.
This menu may be several layers deep. The piece of text
(from within the selected file) should then be inserted.
Creating the menu is no problem.
I would want to have one procedure that takes as a
parameter the file's path and then inserts the text from
that file into the current document. Creating this
procedure is, again, no problem.
However, the OnAction property for Command Bar Buttons in
Word does not seem to allow parameters to be passed to the
procedure.
If I could reference the button pressed from my procedure
I could use its parameter property to pass the information
but I can't reference the button without passing a
parameter!
I can't create a separate procedure for each file as the
number and names of the files will change and there will,
at a minimum, be 100 different files.
I can't create class modules and declare variables
withevents for the same reason.
I have considered using a database to store the text but,
currently, this is not an acceptable solution. Even so, I
would still need to pass something to the procedure to say
which item from the database should be inserted.
Have I missed something and is there a way round this?
pieces of text (e.g. marketing blurb, resumes, case
studies etc.) to be inserted easily into a Word XP
document. These pieces of text will be stored in separate
files within a (flexible) folder structure.
Users will select the text files from a dropdown menu
(CommandBarPopup) on a Command Bar in Word. This menu will
be populated from the physical folder structure on a disc.
This menu may be several layers deep. The piece of text
(from within the selected file) should then be inserted.
Creating the menu is no problem.
I would want to have one procedure that takes as a
parameter the file's path and then inserts the text from
that file into the current document. Creating this
procedure is, again, no problem.
However, the OnAction property for Command Bar Buttons in
Word does not seem to allow parameters to be passed to the
procedure.
If I could reference the button pressed from my procedure
I could use its parameter property to pass the information
but I can't reference the button without passing a
parameter!
I can't create a separate procedure for each file as the
number and names of the files will change and there will,
at a minimum, be 100 different files.
I can't create class modules and declare variables
withevents for the same reason.
I have considered using a database to store the text but,
currently, this is not an acceptable solution. Even so, I
would still need to pass something to the procedure to say
which item from the database should be inserted.
Have I missed something and is there a way round this?