我一直在尝试各种方法,以使用户可以轻松地更新合同模板上几个Word Content Controls中的文本字体名称。有一种用于编辑控件文本的表单,该表单可以具有命令按钮来运行该过程。我想让它变得容易,并将用户与内容控件隔离开来;这是一件很精致的事情;)
这是我想做的(我尝试了此代码的许多排列):
Dim dlg As Dialog
' Initialize the dialog
Set dlg = Dialogs(wdDialogFormatFont)
' Open the font dialog
dlg.Show
' Set the contentcontrols' text font name to the chosen one from the font dialog
ThisDocument.ContentControls(1).Range.Font.Name = Dialogs(wdDialogFormatFont).Font.Name
代替dlg.Show
,请使用dlg.Display
。 Show
方法结合了Display
和Execute
,因此您将无法获得所选的字体来应用。
请参阅VBA reference以获取更多信息。