Hi,
I am new to this forum and this is my first post. (Even though I have used the forum extensively as a Guest )
I have coded this macro that will change the display text of a from field in word. I have made a word document with checkboxes, which I am protecting to activate the checkboxes. However I want the users to enter certain data to the document. For this I have added a ‘MACROBUTTON’ field, which will trigger below procedure:
Dim strProject As String
pType = ActiveDocument.ProtectionType
If pType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
End If
strProject = InputBox(Prompt:="Please add the project name", Title:="Add Project", xpos:=7500, ypos:=5000)
If strProject = "" Then 'in case user clicks cancel in the inputbox
strProject = "Double-click here to add project"
End If
ActiveDocument.Fields(1).Code.Text = "MACROBUTTON addProject " & strProject 're-coding the form field
ActiveDocument.Protect Type:=wdAllowOnlyFormFields 'enabling checkboxes
Set pType = Nothing
I wanted to know how robust the macro is? And possible ways to improve it?
Thank you
Bookmarks