Button on page to run macro

  • Thread starter Francis Hookham
  • Start date
F

Francis Hookham

Having transferred a module containing a series of subroutines from 'Normal'
to a Word document I want others to be able to run two of the subs from that
document since they will not understand how to transfer the module to their
Normal file.



Question

How can I assign a macro to an object on the page which the user can click
to run the macro? In XL that's simple but in Word I cannot see how to do it.



Francis Hookham
 
J

Jezebel

A macrobutton field is the obvious answer.

But separately, unless this code needs to be run only once, putting the
macros in documents (as opposed to templates or add-ins, where they belong)
is likely to spell disaster. The maintenance challenge is insurmountable.
 
F

Francis Hookham

I'm not getting anywhere - I see the Insert > Field > Document Automation >
MacroButton and Options and choosing the macro and adding to the field which
produces a field on the Template but that's as far as I get - it does not
click - can you point me to a website where I shall find more info.

The macro pastes in as text part of a calendar copied from my club's website
and formats the text in a particular way - I can run the macro from a button
on my toolbar but I wanted to send a Word document (or a template if that is
the way to do it) which someone else, who does not have ther knowledge to
put the macro into his Normal, could use. I thought a document which held
the macro on a button could be the answer.

Any suggestions apart from 'give up' or 'use XL instead'?
 
J

Jezebel

Francis Hookham said:
I'm not getting anywhere - I see the Insert > Field > Document Automation
which produces a field on the Template but that's as far as I get - it
does not click - can you point me to a website where I shall find more
info.

You don't need a website: Word's Help explains the fields.

Press Alt-F9 to display field codes. You should have a field that looks
something like

{ MACROBUTTON MyMacro DoubleClick }

where 'MyMacro' is the name of your macro and 'DoubleClick' is whatever text
you actually want to see in the document. You'll probably want to format
this distinctively. Press Alt-F9 to hide field codes, then double-click.
 

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