我有一个50页的Word文档,每页都有一个ActiveX复选框。当我以任何形式(即打印机或PDF)打印文档时,我不希望显示这些内容。
我用Google搜索了两个例子;
Sub ChangeHidden2()
Dim doc As Word.Document
Dim rngSearch As Word.Range
Dim ffld As Word.FormField
Set doc = ActiveDocument
Set ffld = doc.FormFields("check1")
Set rngSearch = ffld.Range.Paragraphs(1).Range
rngSearch.Start = ffld.Range.End
rngSearch.Text = "Good"
End Sub
但这只隐藏了第一个复选框,而不是所有复选框,并且;
Sub HideFormsChBx()
Dim doc As Word.Document
Dim cBx As Word.FormField
Dim cntrl As Word.CheckBox
Set doc = ActiveDocument
Set cBx = doc.FormFields("Check1")
Set cntrl = doc.FormFields("Check2").CheckBox
If doc.ProtectionType <> wdNoProtection Then _
doc.Unprotect
cBx.Range.Font.Hidden = cntrl.Value
doc.Protect wdAllowOnlyFormFields, True
End Sub
这似乎对我不起作用(各种错误)。
ffld
基于此。