Is it possible to create a macro (actually a function) and place it somewhere (i suppose in a dummy word document) so it can be called by several different macros from other word document?
For small things you can place it on normal.dot.
For big things I would create a new document just for that and I would place a reference to it on the normal.dot.
I would rather have a few lines stored somewhere and have them automaticly copy/paste in all of my word document and then interprete them. SO i can put the following code in a central "function".
Create a new document ABC
add the following code to it (alt-f11 to open the VBA editor…)
Sub grammar()
ActiveDocument.CheckGrammar
End Sub
Go to the document again,
right-click on the toolbar->customize->toolbar->new
Give the name to the toolbar and make it available to ABC only, not normal.dot
Place this new toolbar on the toolbar group.
Now you need to place a macro button on it.
Still within the customize panel.
select commands->macros
select and drag the macro (grammar) into the new toolbar.
Once there right-click on the new macro name within the toolbar and change it's name to something more user-friendly.
(you can also change the image of the macro if you wish).
Now save this document as a ".dot", and place it within the STARTUP folder of word. (tools->options->file locations->startup)
Now go to tools->templates&add-ins and add the new template to the list.
Close word.
Next time you start you will have a button available on the toolbar with the new macro.
This code is really just an example. You can create almost anything you wish with this method.
Application.Run "Normal.Module1.MAIN"
Application.Run "MyProject.MyModule.MyProcedure"
Application.Run "'My Document.doc'!ThisModule.ThisProcedure"
If you specify the document name, your code can only run macros in documents related to the current context — not just any macro in any document.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.