🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16362

[VB] Search into a Selection

#16362
From: Guy Verville
Date: Thu, 18 Sep 2003 16:00
26 lines
1545 bytes
Hi,

I'm pretty new the ID object model and some things still elude me. I want to perform a simple search and replace on a selection (changing numbers to a character style called (Chiffre).

Dim k
Set myindesign = CreateObject("InDesign.Application.2.0")
Set MyDoc = myindesign.ActiveDocument
Set MySelection = MyDoc.selection

' clears find preferences
myindesign.FindPreferences = idNothing
myindesign.ChangePreferences = idNothing
' sets the replacement CharacterStyle
myindesign.ChangePreferences.CharacterStyle = myDoc.CharStyles.Item("Chiffre")

'Loops through the numbers
For k = 0 To 9
    MyText= LTrim(k)
    MySelection.Search MyText, false, false, MyText	
Next

MySelection can't have a .Search property... If I change to myIndesign or MyDoc, it's ok, but I want the changes only applied to a selection.

Thanks to help!

Guy
Technical Details
Message-ID: <2ccd782d.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,679c718bcdc39c50,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-09-18 09:08:20 PST
From: "Guy Verville" <taddeus@spamcop.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: [VB] Search into a Selection
Message-ID: <2ccd782d.-1@webx.la2eafNXanI>
Date: Thu, 18 Sep 2003 09:00:20 -0700
Lines: 30
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit