问题描述
在限制编辑下,用户只能添加或删除单词。我可以只允许用户更改字体大小吗?
解决方法
您将不得不编写一个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