🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19056

Re: Select text block in VB

#19056
From: Jack Gregory
Date: Tue, 21 Jan 2003 17:59
15 lines
1654 bytes
Well, I figured this out myself, so I thought I would post it here so that any VB person does not have to go through the struggle that I did. The trick is the undocumented "ItemByRange" method on the Characters collection:

'Place cursor in caption, ready to enter text
    myCaptionFrame.TextContents = "<Enter Caption here>"
    Dim myChar1 As Character
    Dim myCharLast As Character
    Set myChar1 = myCaptionFrame.ParentStory.Characters.Item(1)
    Set myCharLast = myCaptionFrame.ParentStory.Characters.Item(-1)
    myInDesign.Select myCaptionFrame.ParentStory.Characters.ItemByRange(myChar1, myCharLast)

There does not appear to be any place that says that "-1" is a legit way to get the "last" character, but it seems to work.

Any comments on the above code, especially if it makes it clearer or shorter, would be appreciated.

--Jack Gregory
Technical Details
Message-ID: <1de7681a.3@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.mountaincable.net!solnet.ch!solnet.ch!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de7681a.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,148624ca6847d0bb
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-01-21 10:08:08 PST
From: "Jack Gregory" <jgg@ultranet.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.mountaincable.net!solnet.ch!solnet.ch!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Select text block in VB
Message-ID: <1de7681a.3@WebX.la2eafNXanI>
Date: Tue, 21 Jan 2003 09:59:38 -0800
References: <1de7681a.-1@WebX.la2eafNXanI>
Lines: 21
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit