On Field Mouseclick- run macro?

K

Kenny Bones

Hi, I've got a drop-down list in a table that I want to get working.
However, the document contains several sections and if I protect the whole
section, the other parts of the same table which the drop-down list is in,
also get protected and therefore cannot be accessed.

Now, I've found that I can probably write a macro which protects and
uprotects the document. And I was thinking of having this macro run IF the
user clicks on the field.

Short pseudocode :
(Dropdown1 and Dropdown2 are the bookmark names of the fields)

With ActiveDocument
If Dropdown1_Click or Dropdown2_Click Then
ActiveDocument.Protect wdAllowOnlyFormFields
End If
ActiveDocument.Unprotect
End With
End sub

Can this be done?
 
G

Graham Mayor

You could do that, but you have made no provision for re-protecting. Forms
need protecting to work. Perhaps you would answer the question in your other
thread before running off at a tangent?

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

You may be able to use the selection change event to protect the form on
entry to the cell that contains the drop down.

Alternatively, use an ActiveX combobox, which will not require that the
document be protected. You will however need to use code in the Document
New or Document Open events to populate the combobox.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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