Private Sub 隐藏选择的对象()
ActiveDocument.Unit = cdrMillimeter
Optimization = True
If ActiveDocument.SelectionRange.Count > 0 Then
ActiveSelectionRange.Cut
隐藏对象
End If
Optimization = False: ActiveWindow.Refresh: ActiveDocument.ClearSelection '取消选择
End Sub
Function 隐藏对象()
Dim layerName As String
layerName = "隐藏"
Dim layers As layers
Set layers = ActiveDocument.ActivePage.layers
Dim lyr As Layer
On Error Resume Next ' 忽略错误
Set lyr = layers.Item(layerName)
If Err.Number <> 0 Then ' 如果 Item 方法返回错误
Err.Clear ' 清除错误
Set lyr = layers.Find(layerName)
If lyr Is Nothing Then
Set lyr = ActivePage.CreateLayer(layerName)
End If
End If
lyr.V