3 Replies Latest reply on Aug 10, 2008 2:17 AM by (Robert_Tkaczyk)

    How to get the Page Number in CS3 with VB?

      Hi, Everybody
      I use the Visual Basic to read the words and their page number where the Words are at. I want to do it according to Story. Some TextFrame of the Story waw placed in other pages: How can I get the Page number according to the Word that is selected?
      For myStoryCounter = 1 to Document.Stories.Count
      Set myStory = Document.Stories.Item(myStoryCounter)
      For myWordCounter = 1 to myStory.Words.Count
      Set myWord = myStory.Words.Item(myWordCounter)
      myWordContents = myWord.Contents
      Rem ** How to Get the Page Number according to the Word ***
      Next
      Next
        • 1. Re: How to get the Page Number in CS3 with VB?
          Level 1
          set myPage = myWord.ParentTextFrames.Item(1).Parent

          of course this will be true if your TextFrame is located on Page - it's not InLine or part of group or lie on Spread

          robin

          --
          www.adobescripts.com
          • 2. Re: How to get the Page Number in CS3 with VB?
            Level 1
            Robin

            Thank you. I have tried it. Sounds Good. But I don't understand why Item(1) are set.
            Set myPage =myWord.ParentTextFrames.Item(1).Parent
            PageNo = myWord.Documentoffset

            There is another Question that why Story.TextFrames.Count alway is 0, Is it bug?

            Alex
            • 3. Re: How to get the Page Number in CS3 with VB?
              Level 1
              > But I don't understand why Item(1) are set.

              because Word can have more than one parent TextFrame - when split across TextFrames
              only Character have one ParentTextFrame accessed also by ParentTextFrames.Item(1)

              > why Story.TextFrames.Count alway is 0, Is it bug?

              no - it's not bug
              in older IDs - Story.TextFrames collection refer to all TextFrames as containers for Story text
              but in CS3 - collection Story.TextFrames contain all TextFrames inserted as InLine/Anchored objects - same like Story.Rectangles or Story.Ovals
              in CS3 - when you want to refer to TextFrames as containers for Story text - you need to use Story.TextContainers - because now you can link TextFrame and Text-On-Path as Story - Text-On-Path isn't TextFrame

              robin

              --
              www.adobescripts.com