Hello.Who can help me find a memory leak?
I have a page on which a lot of PowerClip. I need to export each PowerClip to TIFF.
File name must be (sizeWidth x sizeHeight_NumberShop) - example: 594x841_Shop2.
My code is working but when it comes to the line: .PowerClip.EnterEditMode - I have memory leak.
Sorry my English. Thanks.
My code:
Dim s As ShapeRange, sr As ShapeRange Dim PwcObj As Shape, PwcObjectAll As Shape Dim count As Integer Dim toFind As String, toFindObval As String Dim pwc As PowerClip Dim W As String, H As String, IndName As String Application.Optimization = True
Set PwcObjectAll = ActiveShape Set s = ActiveSelectionRange
For Each PwcObjectAll In s.Shapes With PwcObjectAll Set PwcObj = ActiveShape .PowerClip.EnterEditMode '<=PROBLEM HERE ActiveLayer.Shapes.All.CreateSelection Set sr = ActiveSelectionRange.UngroupAllEx ActiveDocument.Unit = cdrMillimeter W = Fix(.SizeWidth) H = Fix(.SizeHeight)
For Each PwcObj In sr.Shapes If PwcObj.Type = cdrTextShape Then If InStr(1, PwcObj.Text.Story, toFind) > 0 Or InStr(1, PwcObj.Text.Story, toFindObval) > 0 Then PwcObj.OrderToFront OutputFile = fld + "\" + W + "x" + H + "_" + PwcObj.Text.Story End If End If Set PwcObj = Nothing Next PwcObj Set Filter = ActiveDocument.ExportBitmap(OutputFile + ".tif", cdrTIFF, cdrSelection, cdrCMYKColorImage, 0, 0, Resolution, Resolution, cdrNormalAntiAliasing, False, False, True, False, cdrCompressionLZW) Filter.Finish Set Filter = Nothing .PowerClip.LeaveEditMode Application.Clipboard.Clear End WithNext PwcObjectAllActiveDocument.EndCommandGroupActiveDocument.Undo Application.Optimization = False Application.Refresh