Sub SP2FixScaledOutline()
Dim p As Page, cnt&, numPages&, cnt0&, s$, res As New ShapeRange, oldP As Page, o As New Outline
If ActiveDocument Is Nothing Then Exit Sub
On Error Resume Next
ActiveDocument.BeginCommandGroup "Fix SP2 phantom outline"
Optimization = True
EventsEnabled = False
ActiveDocument.SaveSettings
ActiveDocument.PreserveSelection = False
Set oldP = ActivePage
numPages = ActiveDocument.Pages.Count
For Each p In ActiveDocument.Pages
p.Activate: SP2FixScaledOutline2 p.Shapes.FindShapes, res
If cnt0 <> res.Count Then s = s & "Page " & CStr(p.Index) & " outlines converted: " _
& CStr(res.Count - cnt0) & vbCrLf: cnt0 = res.Count
Next p
o.Type = cdrNoOutline: o.Width = 0: o.ScaleWithShape = False
If res.Count > 0 Then
res.SetOutlineProperties , , , , , , cdrFalse
res.SetOutlineProperties 0, , , , , , cdrFalse
res.ApplyOutline o
End If
ActiveDocument.PreserveSelection = True
ActiveDocument.RestoreSettings
EventsEnabled = True
Optimization = False
Application.CorelScript.RedrawScreen
ActiveDocument.EndCommandGroup
oldP.Activate: res.CreateSelection
'If res.Count > 0 Then MsgBox CStr(res.Count) + " phantom scaled outlines cleared" + vbCrLf + s
End Sub
Sub SP2FixScaledOutline2(shs As ShapeRange, res As ShapeRange)
Dim sh As Shape
On Error Resume Next
For Each sh In shs
If sh.Outline.Type = cdrNoOutline Then _
If sh.Outline.ScaleWithShape Then res.Add sh
If Not sh.PowerClip Is Nothing Then _
SP2FixScaledOutline2 sh.PowerClip.Shapes.FindShapes.All, res
Next sh
End Sub