Actixe X Controls

K

Ken Curtis

I am having a problem with Active X controls (i.e. buttons, check boxes, etc)
in Word documents: I can't get them to work. In access this is easy, so
obviously I am missing something.
For example, if I write a macro to copy and paste something, and then 'run'
the macro, it works. However, when I assign the macro to a 'button' or
'check box' (on enter or exit), I get nothing ... no action at all, except to
highlight the control (double clicking the control takes me back to the macro
editor). This problem is even greater when I 'lock' the form with a
password: then the control does nothing at all.

Is there a trick to this?
 
G

Graham Mayor

The controls are primarily designed for web page creation. Use instead form
fields then protect the document for forms.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Ken Curtis

Yes, I understand the concept of 'form fields', I use them extensively in
locked forms. However, to the best of my knowledge, a form field does not
address my need to activate macro's by using controls I place on a form.
Also, Word's 'Help' offers the following: "The controls in the Control
Toolbox do not function in many browsers so it is recommended that you use
them for forms that will be filled out in Microsoft Word, not for Web forms".

Any other thoughts?
 
G

Graham Mayor

There is little limit to the macro code that you can run on entry to or on
exit from a form field. You will find lots of examples on my web site, and
on the MVPS web site you will find details of how to (e.g.) make check boxes
work like radio buttons. The only major problem that you are likely to
encounter is persuading remote users to allow your macros to run. Over that
you have no control whatsoever.

However if you wish to persist with the control toolbox, ensure that you
exit from design mode before attempting to use the controls.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Ken Curtis

Graham, I understand what you are saying ... but...

Let me give you an example of what I would like to do in a 'protected' form
(well, I thought it was 'protected' until I read what you wrote about getting
around pesky passwords!).

Example: In a locked form there is a one row table with a form field to
accept text. I want to be able to have a control on the form (I was thinking
'button' or 'check box') that would add another row (including a form field)
below the original row. Remember, now, that this form is locked, so the
usual method of adding a new row (tab) is not available.

Ideas
Ken Curtis
 
P

Peter Jamieson

1. Which version of Word? (actually, it does not matter so much for this
- it's when you talk about Web stuff that things can become a bit
different in Word 2007)
However, when I assign the macro to a 'button' or
'check box' (on enter or exit)

Assigning to enter or exit suggests that you may indeed be doing
something wrong - when you double-click on an ActiveX control in design
mode, you should (probably see)
a. the VBA Editor
b. the Properties Window in the editor (or do View->Properties Window
to see it
c. An empty event handler (unless you have already written some code),
e.g.

Private Sub TextBox1_Change()

End Sub

If you pop some code in that, e.g.

Private Sub TextBox1_Change()

msgbox "I changed"

End Sub

then toggle Design Mode so it's off, then type a character in your text
box, which I have just assumed you have, you should see your message box.

If you are already doing all that and nothing is happening, I would have
to guess it's a macro enabling thing, but I have to say it doesn't sound
like it from your description.


Peter Jamieson

http://tips.pjmsn.me.uk
 

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