QAT macro button doesn't work

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I've assigned a macro to a QAT button, and nothing happens when I click it.
I put a breakline at the beginning of the macro, and it never even runs. Any
thoughts?
 
Macro security could be preventing the macro from running. Where did you
store the file containing the macro?
 
The file is in the normal template. The templates directory seems to be a
trusted location.
 
Post your code so we can see what the macro does.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Public Sub main()

If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
StatusBar = "Form is protected."
ElseIf ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
StatusBar = "Form is unprotected."
End If

End Sub
 
Public Sub main()

If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
StatusBar = "Form is protected."
ElseIf ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
StatusBar = "Form is unprotected."
End If

End Sub
 
As a standalone macro it won't work because of your naming convention, but
as

Sub ToggleProtect()
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
StatusBar = "Form is protected."
ElseIf ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
StatusBar = "Form is unprotected."
End If
End Sub

it works just fine - you might find
http://gregmaxey.mvps.org/Classic Form Controls.htm useful as it
provides continuous visible indication that the form is protected, whereas
your macro only shows it until your take some further action.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Actually it should have worked as you had it named - testing again this
morning it does work as you posted it. Do you have two active macros with
the same name?

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top