🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8572

I know this should be simple, but how do I get the selected text?

#8572
From: StevenLmas
Date: Wed, 11 Oct 2006 14:05
22 lines
1176 bytes
Hi,

Trying to get the selected text and set the section marker to whatever I've got selected, but I can't figure out how to get my selection to save my life...

Sub SetSection()
Dim inD As InDesign.Application
Dim iDoc As InDesign.Document

Set inD = CreateObject("InDesign.Application.CS2")
Set iSel = inD.Selection(1)

If TypeName(iSel.Item(1)) = "Text" Then
    x = iSel.Item(1).Words 'doesn't work
    x = iSel.Item(1).Text.Contents 'doesn't work
Else
    MsgBox "You must have one or more characters of text selected"
End If

End Sub

Thanks in advance for your help!
Steve
Technical Details
Message-ID: <3bc1efe9.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,70d1d670d6ed3210,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: StevenLmas@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: I know this should be simple, but how do I get the selected text?
Message-ID: <3bc1efe9.-1@webcrossing.la2eafNXanI>
Date: Wed, 11 Oct 2006 07:05:29 -0700
Lines: 24
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing