MS Word Legacy Form Text Form Field 限制编辑除了改变字体大小

MS Word Legacy Form Text Form Field restrict editing except changing the font size

在限制编辑下,用户只能添加或删除单词。我可以只允许用户更改字体大小吗?

您必须编写一个 kluge 来显示字体大小的用户窗体,然后取消保护该窗体,设置字体大小并重新保护。此示例不包括用户表单:

Dim FontSize As Long

Sub SetSize()
    FontSizeDlg.Show    'Dialog allows user to choose size, which sets the FontSize variable
    With ActiveDocument
        If .ProtectionType = wdAllowOnlyFormFields Then
            .Unprotect
        End If
        .Bookmarks("Name").Range.Font.Size = FontSize
        .Bookmarks("Class").Range.Font.Size = FontSize
        If .ProtectionType = wdNoProtection Then
            .Protect Type:=wdAllowOnlyFormFields, noreset:=True
        End If
    End With
End Sub