Article View: adobe.scripting.indesign
Article #16465Re: [VB] Search problem
From: Olav Kvern
Date: Fri, 05 Sep 2003 07:59
Date: Fri, 05 Sep 2003 07:59
48 lines
1928 bytes
1928 bytes
Alex-- When you select a table, you'll see as you debug (using the Watch window or the Locals window) that the type of the selection is "Cell"--to select the table, get the parent of the cell, as in: Set myTable = myInDesign.Selection.Item(1) If TypeName(myTable) = "Cell" Then Set myTable = myTable.Parent End If When you have the text frame selected, you can get at the table using: Set myTable = myInDesign.Selection.Item(1).Tables.Item(1) The best thing to do is probably to write a "selection sorter" that acts according to the type of the selection. A typical selection sorting routine looks something like this: If myInDesign.Selection.Count > 0 Then Select Case TypeName(myInDesign.Selection.Item(1) Case "TextFrame" Rem Do something Case "Cell" Rem Do something else Case "InsertionPoint", "Character", "Word", "TextStyleRange", "TextLine", "Paragraph", "TextColumn", "Text", "Story" Rem Do something else Case Else Rem do nothing End Select End If InDesign doesn't crash here when I run your snippet on a text frame--I'm assuming that there's something else going on in your code that causes the crash. Thanks, Ole
Technical Details
Message-ID:
<2ccd4178.0@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!newsfeed.news2me.com!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccd4178.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,602b2494ebf84b4a X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-09-05 01:13:12 PST From: "Olav Kvern" <okvern@adobe.com> 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!newsfeed.news2me.com!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: [VB] Search problem Message-ID: <2ccd4178.0@webx.la2eafNXanI> Date: Fri, 5 Sep 2003 00:59:33 -0700 References: <2ccd4178.-1@webx.la2eafNXanI> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit