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
 
Ad

Advertisements

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.
 
Ad

Advertisements

Joined
May 12, 2015
Messages
1
Reaction score
0
Hi there, I also need to develop a macro that will allow users to add or delete a row of a table in a protected Word10 document but I'm having trouble with the protect and unprotect commands within my macro. I will admit that I've never played with macros before so I'm probably missing something simple. I was able to record the "add line" move that I want and even figured out how to input form fields to the table cells, and linked it to an alt command.

However, once I lock the form it disables my macro. I tried to copy and paste the above If Active dialogue into the macro but I get an error and it runs a debugger that I don't understand.

Can someone help please? Thanks!

Applesauce
Forum Newbie
 

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