![]() |
#1
|
|||
|
|||
![]()
I'm currently using a loop that looks at each individual object in a document, checks its width and color and then either deletes it or moves it to a new layer. Some documents contain 20,000 objects. Using this type of loop is very slow. Does anyone have an ideas on how i could speed it up. The code i'm using is shown below. Many Thanks
For Each t In ActivePage.Shapes ProgressBar1.Value = counter counter = counter + 1 t.Outline.Color.ConvertToCMYK If t.Outline.Width < 0.003 Then t.Delete ElseIf t.Outline.Color.CMYKBlack <> 100 Then t.Outline.Width = 0.003 t.Layer = lyr ElseIf t.Outline.Color.CMYKBlack = 100 Then t.Outline.Width = 0.003 End If Next |
#2
|
|||
|
|||
![]()
Read in Help about Optimization command, or seek for messages with this word in forum.
Now about your macro: Code:
For Each t In ActivePage.Shapes ProgressBar1.Value = counter counter = counter + 1 If t.Outline.Width < 0.003 Then t.Delete 'Delete objects before converting them to CMYK, you can save 19999 conversions in your 20000 objects :) t.Outline.Width = 0.003 'You are setting width = 0.003 to all undeleted objects, why not to make it here t.Outline.Color.ConvertToCMYK If t.Outline.Color.CMYKBlack <> 100 Then t.Layer = lyr Next |
#3
|
||||
|
||||
![]()
I believe that the following code will run even faster:
Code:
Dim srDelete As New ShapeRange Dim srMove As New ShapeRange Dim t As Shape Dim c As Color For Each t In ActivePage.Shapes ProgressBar1.Value = counter counter = counter + 1 If t.Outline.Width < 0.003 Then srDelete.Add t Else t.Outline.Width = 0.003 Set c = t.Outline.Color c.ConvertToCMYK If c.CMYKBlack <> 100 Then srMove.Add t End If srDelete.Delete srMove.CreateSelection ActiveSelection.Layer = lyr Next t You can also update outlines in similar way if you just need to convert the outline color model just to see if it is black. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Palette (or Colors array) property in VBA class in CDR12 | zlatev | CorelDRAW/Corel DESIGNER VBA | 7 | 22-02-2005 11:28 |
object lost it's linear fountain fill property after | metalickaah | CorelDRAW/Corel DESIGNER VBA | 5 | 02-01-2005 22:36 |
Sorting entries in the object manager | dan | CorelDRAW/Corel DESIGNER VBA | 1 | 18-08-2004 22:16 |
Font Substitution Upon Import | RobC | CorelDRAW/Corel DESIGNER VBA | 4 | 10-03-2003 23:06 |
VB6, GMS questions | bbolte | CorelDRAW/Corel DESIGNER VBA | 12 | 06-12-2002 15:32 |