How do I assign a Macro to a Commandbutton on MS Word?

J

Jean-Guy Marcil

Carlos was telling us:
Carlos nous racontait que :
I am having trouble getting a commandbutton to run a macro on a form
template.

You are not giving us much to go on here...
What type of trouble? What are the observable results vs.. the expected
behaviour?
A button on a command bar or a macrobutton?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
C

Carlos

Jean-Guy Marcil said:
Carlos was telling us:
Carlos nous racontait que :


You are not giving us much to go on here...
What type of trouble? What are the observable results vs.. the expected
behaviour?
A button on a command bar or a macrobutton?
Once I create a commandbutton, I see no way of assigning it to a Macro.

I've tried a Macro Button, but that only works when the form is unprotected.
Once I protect the form, I can not execute the Macro by pressing the
Macrobutton.

I have restrictions set to allow filling in form fields.

The Macro is basically a script that saves the data in the form fields to a
spread sheet. However, I can't get it to execute once the form is protected.
 
J

Jean-Guy Marcil

Carlos was telling us:
Carlos nous racontait que :
Once I create a commandbutton, I see no way of assigning it to a
Macro.

On the toolbar or from the control toolbox?
I've tried a Macro Button, but that only works when the form is
unprotected. Once I protect the form, I can not execute the Macro by
pressing the Macrobutton.

You have to double click the MacroButton. It works whether the form is
protected or not...
I have restrictions set to allow filling in form fields.

The Macro is basically a script that saves the data in the form
fields to a spread sheet. However, I can't get it to execute once the
form is protected.



--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
F

fumei via OfficeKB.com

Use an ActiveX commandbutton (from the Controls toolbox). It will work even
when the document is protected for forms. Depending of course on what
EXACTLY are the instructions you give it. When a document is protected for
forms some actions are not permitted. However, you could certainly, within
the ActiveX commandbutton turn off protection, do whatever, then turn
protection back on.
 

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