Group: microsoft.public.word.vba.general
From: Jay Freedman
Date: Thursday, February 21, 2008 7:33 PM
Subject: Re: Macros and Protect / Unprotect

The problem with using a macrobutton field in a protected form is that you can't
really double-click it. Word sees the first click as an attempt to select
something in the protected area of the form, and before your second click
registers as being part of a double-click, the cursor is forced into the next
available form field. The macro never gets invoked.

The solution is another macro that tells Word to execute the macrobutton field
on a single click instead of a double-click. See the "Double-click or
single-click" section of
http://www.word.mvps.org/FAQs/TblsFldsFms/HLinksInForms.htm.


On Thu, 21 Feb 2008 14:18:00 -0800, DJElliott
wrote:

>Jay, I am still struggling to create a form in MS Word 2003 (XP). I want to
>use a macro button that allows a user to save/close a document and one that
>routes it.
>I tried using a macrobutton, but run into the protected/unprotected
>minefield. I double click on the macrobutton and nothing happens. :-)
>
>Public Sub SaveIt()
>'
> With ActiveDocument
> If .ProtectionType <> wdNoProtection Then
> .UnProtect Password:=""
> End If
> End With
>'
>'Enable ENTER key on exit
> Application.Run MacroName:="ReinstateEnterKey"
> MsgBox Prompt:="SAVES and CLOSES supplier maintenance document, but
>does not route it."
> If ActiveDocument.Saved = False Then ActiveDocument.SaveAs
>ActiveDocument.protect Type:=wdAllowOnlyFormFields, _
> NoReset:=True, Password:=""
>'Close saved supplier maintenance form
> ActiveDocument.Close
>End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.