Excel / VBA:我可以设置一个形状属性来防止打印形状吗?

时间:2011-03-29 16:42:44

标签: excel vba excel-vba excel-2007

我写了一些VBA代码来为GUI创建一些形状,但我试图确保不会打印形状。由于我是动态创建这些形状,因此无法手动将每个形状设置为不打印。有没有办法以编程方式进行?

  Set roundedRec = ws.Shapes.AddShape(msoShapeRectangle, 10, 10, 10, 10)

  roundedRec.Name = shapeName

  With roundedRec
    .Fill.Visible = msoFalse
    .Line.ForeColor.RGB = RGB(0, 204, 0)
    .Line.Style = msoLineThinThin
    .Width = target.Width + 4
    .Left = target.Left - 2
    .Height = target.Height + 4
    .Top = target.Top - 2
    .ZOrder (msoSendToBack)
    ' need a way to set the shape to NOT print...?
  end with

1 个答案:

答案 0 :(得分:5)

.ControlFormat.PrintObject = False