Article View: adobe.scripting.indesign
Article #20187Re: Find and Replace in InDesign 2 again
From: Olav Kvern
Date: Sun, 04 Aug 2002 04:24
Date: Sun, 04 Aug 2002 04:24
33 lines
1965 bytes
1965 bytes
Michael--
Sorry, I thought I'd posted something. Here's a snippet containing three simple examples (and a utility subroutine for clearing the find/change attributes):
Private Sub Command1_Click()
Dim myInDesign As InDesign.Application
Dim myDocument As InDesign.Document
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.ActiveDocument
Rem Clear the find/change attributes settings between each find/change operation
myClearAttributes myInDesign
Rem Simple find/change
myDocument.Search "Shirley Temple", False, False, "Devil Hunter Yohko"
myClearAttributes myInDesign
Rem Simple find (and put found items in a collection)
Set myFoundItems = myDocument.Search("Utena Tenjou")
myClearAttributes myInDesign
Rem Simple find/change with formatting (no change to the text string)
myInDesign.FindPreferences.PointSize = 12
myInDesign.ChangePreferences.PointSize = 24
myDocument.Search "Word", True, False, "Word"
myClearAttributes myInDesign
End Sub
Private Sub myClearAttributes(myInDesign)
Rem Clear the find/change attributes settings
myInDesign.FindPreferences = idNothing
myInDesign.ChangePreferences = idNothing
End Sub
Thanks,
Ole
Technical Details
Message-ID:
<efa02b7.0@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<efa02b7.-1@WebX.aaQKaf7vad4>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,aacf10682491e407 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-08-03 21:41:07 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Find and Replace in InDesign 2 again Message-ID: <efa02b7.0@WebX.aaQKaf7vad4> Date: Sat, 3 Aug 2002 21:24:44 -0700 References: <efa02b7.-1@WebX.aaQKaf7vad4> Lines: 36 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit