unprotect run a macro then protect a form again

  • Thread starter Thread starter Johnnyboy5
  • Start date Start date
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
 
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.
 
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
 
Back
Top