can anyone help me write a script that replaces all instances of a text with
another text in Corel Draw 11? i am not a VB expert (actually i am not even
a beginner!).
i have tried something like this:
>
> Sub Translate()
> Dim s As Shape
> For Each s In ActivePage.FindShapes(, cdrTextShape)
> s.Text.Replace "oldtext", "newtext", False, ReplaceAll:=True
> ...
> Next s
> End Sub
>
but it hangs Corel or it takes too long to be useful.
the page contains many artistic text items, rectangles and other raster
images.
please help me, i'm desparate! :)
thanks
"Marius Stuparu" <mari...@sportplus.ro> wrote in message
news:3fa8e942$1_1@cnews...
"Georgeann" <g...@txpress.com> wrote in message news:3fa8ee7f$1_3@cnews...
> can anyone help me write a script that replaces all instances of a text with
> another text in Corel Draw 11? i am not a VB expert (actually i am not even
> a beginner!).
> i have tried something like this:
> >
> > Sub Translate()
> > Dim s As Shape
> > For Each s In ActivePage.FindShapes(, cdrTextShape)
> > s.Text.Replace "oldtext", "newtext", False, ReplaceAll:=True
> > ...
> > Next s
> > End Sub
Sorry this answer is so late, but I just found out about a couple of
optimization techniques that seem to help with the above function.
First before running the script make sure you reduce the default
application undo buffer of 99 to something much lower, I tested the
following with an undo level of 30 on 1938 text strings in a document.
Sub Translate()
Optimization = True ' turn off screen updates
ActiveDocument.PreserveSelection = False 'ignore last selection
Dim s As Shape
For Each s In ActivePage.FindShapes(, cdrTextShape)
s.Text.Replace "oldtext", "newtext", False, ReplaceAll:=True
...
Next s
Optimization = False ' restore screen updates
ActiveDocument.PreserveSelection = True ' remember last selection
ActiveDocument.ActiveWindow.Refresh ' update drawing window
End Sub
HTH
Peter