View Single Post
  #1   Report Post  
Tyho Tyho is offline
Junior Member
 
Posts: 1
Exclamation A many asked Question about Macro

The Question is to Unprotect/hide/protect with a macro.

I already searched on the internet and try almost everything i saw.. Nothing happend.

This is my code:

Sub OntruimingWeg()

' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect Password:="password"
End If

ActiveDocument.Bookmarks("Bookmarksname").Range.Fo nt.Hidden = True

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="password"
End If

End Sub

again i tryed many more codes but nothing seems to work.

pls kan someone help me out?

Edit: I forgot to tell this macro is switched by an selection box. When it's on it's the code shown above. When it's off, its all the same exept "Range.Font.Hidden = False"