我正在尝试以编程方式使用VBA将构建块插入Microsoft Word,并且插入工作时,在打印预览中查看时以及打印时,不会出现构建块。
Sub draw_point()
Dim objTemplate As Template
Dim objBB As BuildingBlock
Selection.MoveDown Unit:=wdLine, Count:=1
' Set the template to store the building block
Set objTemplate = ActiveDocument.AttachedTemplate
' Access the building block through the type and category
Set objBB = objTemplate.BuildingBlockTypes(wdTypeAutoText) _
.Categories("General").BuildingBlocks("point")
' Insert the building block into the document replacing any selected text.
objBB.Insert Selection.Range
End Sub
如果我手动插入构建块,则打印正常。
我通过插入形状创建构建块,然后将其添加到
AutoText > General > Normal.dotm > Insert content only
如果我尝试在新文档上重新创建此问题,则不会发生,但我不确定这两个文档之间的属性有何不同
答案 0 :(得分:1)
如果在打印预览中形状消失,可能是因为在锚定形状的段落的字体设置中设置了隐藏属性。
这也可以解释为什么你不能在另一个文件中复制这个问题。