mvp1985
asked on
Word Makro
I have created a word document with form protected text boxes and assigned a makro with a keyboard shortcut that unprotects and reprotects the sheet after it goes to the end of the document, and I enters a specified auto text. However, the makro doesn't produce an outcome (nothing changes) with some random text to be insterted.
So here my questions:
How do I assign the autotext "abc" instead of the random text?
And what, if anything is wrong with the makro, since it doesn’t work? one reason I could come up with might be that a macbook does not have an EndKey. Does that matter?
So this is the current Makro:
Sub Macro3()
Set aDoc = ActiveDocument
If aDoc.ProtectionType <> wdNoProtection Then
aDoc.Unprotect
Selection.EndKey Unit:=wdStory
Set aDoc = ActiveDocument
If aDoc.ProtectionType <> wdNoProtection Then
aDoc.Unprotect
Selection.InsertBefore "department six"
aDoc.Protect Type:=wdAllowOnlyRevisions , Password:=strPassword
End If
End Sub
thanks.
So here my questions:
How do I assign the autotext "abc" instead of the random text?
And what, if anything is wrong with the makro, since it doesn’t work? one reason I could come up with might be that a macbook does not have an EndKey. Does that matter?
So this is the current Makro:
Sub Macro3()
Set aDoc = ActiveDocument
If aDoc.ProtectionType <> wdNoProtection Then
aDoc.Unprotect
Selection.EndKey Unit:=wdStory
Set aDoc = ActiveDocument
If aDoc.ProtectionType <> wdNoProtection Then
aDoc.Unprotect
Selection.InsertBefore "department six"
aDoc.Protect Type:=wdAllowOnlyRevisions
End If
End Sub
thanks.
It the document is not protected then the code will do nothing
If it is protected, you remove the protection, then you test it again. That test will be false and so nothing will be done.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Solved my first question, but not my second