N
NZ VBA Developer
Here's a curly one for you all!
I have a series of standard 'office practice' type templates (Fax, Letter,
Memo, etc.) all of which contain code for creating the document in the first
place. This code saves the input in document variables to allow the code to
be rerun should the user get to the end and realise they forgot something.
The rerun code works a treat - or at least it does in the one prototype
template that I've done so far.
I also have a global 'toolkit' type template that's designed to make doing
some key functions easier or just make Word work like it should work: e.g.
insert/delete a landscape section without stuffing up everything; apply
bullets/numbering using the 'List' styles instead of whatever Word wants to
use; copy/reset the standard styles in a document. This works really well,
too.
But now for the tricky part...
I know I could provide access to the rerun macro in each template in a
variety of ways: add a custom button a standard toolbar or create a custom
toolbar for each template or some such. However, since I'd rather not mess
around with any of the standard toolbars (and have my Rerun Template button
get lost in the clutter) and since I don't want to create a bunch of 1-button
toolbars and since the toolkit already has a custom toolbar, what I'd really
rather do is have a button on the Toolkit toolbar for invoking the rerun
macro. But I have some concerns and questions.
First, as would be expected, if just add a button to the Toolkit toolbar for
the rerun macro in a specific template, it only works with a document based
on that particular template. And since there are 11 templates, I would have
to add 11 buttons and then trust the users (stop LAUGHING!!!) to click the
right one or try to trap errors or show/hide buttons based on the attached
template for a document... and I don't even want to think about what would
happen if there were multiple documents open... GAHHH!!!
So I reckon a better approach would be to have a macro (and associated
button) in the toolkit template that just calls the rerun macro in the
attached template. I can guarantee that the name of the macro in each
template would be the same, so that's no problem. However, I'm
concerned/unclear about: 1) how to check that the attached template does
indeed contain a rerun macro; and 2) the actual syntax for calling the macro
in the attached template.
Suggestions? Recommendations? Or have I just spent too much time with the
sheep and am now delusional to even consider it?
I have a series of standard 'office practice' type templates (Fax, Letter,
Memo, etc.) all of which contain code for creating the document in the first
place. This code saves the input in document variables to allow the code to
be rerun should the user get to the end and realise they forgot something.
The rerun code works a treat - or at least it does in the one prototype
template that I've done so far.
I also have a global 'toolkit' type template that's designed to make doing
some key functions easier or just make Word work like it should work: e.g.
insert/delete a landscape section without stuffing up everything; apply
bullets/numbering using the 'List' styles instead of whatever Word wants to
use; copy/reset the standard styles in a document. This works really well,
too.
But now for the tricky part...
I know I could provide access to the rerun macro in each template in a
variety of ways: add a custom button a standard toolbar or create a custom
toolbar for each template or some such. However, since I'd rather not mess
around with any of the standard toolbars (and have my Rerun Template button
get lost in the clutter) and since I don't want to create a bunch of 1-button
toolbars and since the toolkit already has a custom toolbar, what I'd really
rather do is have a button on the Toolkit toolbar for invoking the rerun
macro. But I have some concerns and questions.
First, as would be expected, if just add a button to the Toolkit toolbar for
the rerun macro in a specific template, it only works with a document based
on that particular template. And since there are 11 templates, I would have
to add 11 buttons and then trust the users (stop LAUGHING!!!) to click the
right one or try to trap errors or show/hide buttons based on the attached
template for a document... and I don't even want to think about what would
happen if there were multiple documents open... GAHHH!!!
So I reckon a better approach would be to have a macro (and associated
button) in the toolkit template that just calls the rerun macro in the
attached template. I can guarantee that the name of the macro in each
template would be the same, so that's no problem. However, I'm
concerned/unclear about: 1) how to check that the attached template does
indeed contain a rerun macro; and 2) the actual syntax for calling the macro
in the attached template.
Suggestions? Recommendations? Or have I just spent too much time with the
sheep and am now delusional to even consider it?