Placing a control on a document

P

plh

Hi all,
I am new to Word VBA but have extensive experience with it in Excel and Access.
I am sure this is simple: I need to put a control on the document, as opposed to
the user's tool bar, and then give it a click or double click event, in order to
start things rolling. Ideally I would want a command button but that does not
seem to be an option, at least, I don't see it. What is the best way to proceed?
Thanx,
-plh
 
L

Lisa

On the main menu in Word, go to View | Toolbars, then select "Control
Toolbox" from the pop-up list (click so checkmark shows in front of it).

This will display the Control Toolbox toolbar in Word. Clicking on the
Command Button button on the toolbar will create a Command Button at the
current insertion point (where your cursor is in the document).
 
J

Jean-Guy Marcil

plh was telling us:
plh nous racontait que :
Hi all,
I am new to Word VBA but have extensive experience with it in Excel
and Access. I am sure this is simple: I need to put a control on the
document, as opposed to the user's tool bar, and then give it a click
or double click event, in order to start things rolling. Ideally I
would want a command button but that does not seem to be an option,
at least, I don't see it. What is the best way to proceed? Thanx,
-plh

You could use a macro button field:

Do CTRL-F9 to insert a pair of field delimiters: {}

Then type something like this between the delimiters:

{MACROBUTTON name_of_your_macro Text to be displayed in document}

Finally, with the field selected, do SHIFT-F9 to toggle between field code
and field values.

The user need to double-click on the MacroButton field to launch the macro.

You could use an ActiveX button (from the Control Toolbox toolbar), but if
you plan on distributing your work, you may run in all kinds of problems
with macro security (ActiveX controls are blocked by the security system).

--

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

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