assign a macro to a command button

D

deb

please, somebody tell me how i do this in word?

i can do it in Excel no probs

i have a form that is being filled out and i've created a simple macro to
print, clear and reset the form and i want it to work off a button that says
"finished? click here to print" i know they could print it normally but this
is for some seniors that are not really good with computers and i'm trying to
make it as hassle free as possible
 
J

Jay Freedman

There are at least three different kinds of "command buttons" in Word,
so let's start by determining which one you mean.

- An ActiveX command button from the Control Toolbox toolbar (or, in
Word 2007, on the second row of the Legacy Controls button on the
Developer tab of the ribbon)

- A button on a toolbar (or, in Word 2007, one on the Quick Access
Toolbar)

- A MacroButton field in the document

For an ActiveX button, click the View Code button on the Control
Toolbox toolbar. The VBA editor opens to the command button's Click
event handler. You can put your code directly in that procedure, or
just put in a call to a macro you've already written. Incidentally, if
you want to hide the button during printing, see
http://www.word.mvps.org/FAQs/TblsFldsFms/HidePrintButton.htm.

For a toolbar button, see
http://www.word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm.

For a MacroButton field, see
http://www.word.mvps.org/FAQs/TblsFldsFms/UsingMacroButton.htm and
http://www.word.mvps.org/FAQs/MacrosVBA/AssignMacroToButton.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
A

aqhibjaved

Hi All,

I wanted to write a code to get mac id please help
i can call to cmd but after that i want to run "getmac" command and copy the ethernet physical address into text file .......
shell (cmd.exe)
.....

End Sub
 

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