unprotect run a macro then protect a form again

J

Johnnyboy5

I need this macro to run in a “protected Form”

Can some add what’s needed to unprotect and protect the form when
this macro has been run.

Sub tick()


' tick Macro
' Macro recorded 29/06/2011 by
'
Selection.Font.Size = 18
Selection.InsertSymbol Font:="Wingdings", CharacterNumber:=-3844,
Unicode _
:=True


End Sub

Thanks

Johnnyboy
 
J

Jay Freedman

I need this macro to run in a “protected Form”

Can some add what’s needed to unprotect and protect the form when
this macro has been run.

Sub tick()


' tick Macro
' Macro recorded 29/06/2011 by
'

If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect
End If
Selection.Font.Size = 18
Selection.InsertSymbol Font:="Wingdings", CharacterNumber:=-3844,
Unicode _
:=True

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub

Thanks

Johnnyboy

But note that if the document is protected before you start the macro,
Word won't let you put the cursor anywhere except inside a form field.
So the Selection may not be where you want to insert the character --
you may need some additional logic, such as using the range of a
bookmark instead of the Selection.
 

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