Skip to main content
Participant
May 7, 2008
Question

Find Text in Get Page Number VB CS2

  • May 7, 2008
  • 2 replies
  • 538 views
I am trying to find text in a document and get the page number when it finds the string.
This topic has been closed for replies.

2 replies

Participant
May 8, 2008
Where does myFindResult come from...

Here is part of the code:

myInDesign.Open (vfilename)
Set myDocument = myInDesign.ActiveDocument

myDocument.Search "~" & Trim(RSitem!pcode), False, False, FormatNumber(Trim(CStr(RSitem!msrp)), 2, 0, 0, 0)

Ricky
Known Participant
May 8, 2008
set myResult = myDocument.Search ("~" & Trim(RSitem!pcode), False, False, FormatNumber(Trim(CStr(RSitem!msrp)), 2, 0, 0, 0))

myFindResult = myResult.Item(1)

myPageName = myFindResult.Texts.Item(1).Characters.Item(1).ParentTextFrame.Parent.Name

robin

--
www.adobescripts.com
Known Participant
May 7, 2008
myFindResult.Texts.Item(1).Characters.Item(1).ParentTextFrame.Parent.Name

where:
myFindResult.Texts.Item(1) - found text
myFindResult.Texts.Item(1).Characters.Item(1) - first character
myFindResult.Texts.Item(1).Characters.Item(1).ParentTextFrame - TextFrame
myFindResult.Texts.Item(1).Characters.Item(1).ParentTextFrame.Parent - Page (if TextFrame isn't in Group or isn't as AnchoredObject or InLine Graphic, etc.)

robin

--
www.adobescripts.com