2 Replies Latest reply on Nov 14, 2015 5:08 AM by Peter Kahrel

    Loop through pages and add text box

    urbanl28974291

      I'm trying to loop through the pages of a document (for simplicity, say there are 5 pages) and do some tasks (for simplicity, say add a text box) on each page.

       

      Using VBScript, my thoughts are that something like:

       

      Set myPages = myDocument.Pages

      i = 1

      do until i > 5

          myPages.Item(i).Select()

          set myTextFrame = myDocument.ActivePage.TextFrames.Add

          myTextFrame.Contents = "Hello, World"

          i = i + 1

      loop


      should work.


      But the best I can do (when I'm not getting syntax error messages)  is to get the text written multiple times on one page.


      I know that there's a simple fix that I'm missing.


      Any suggestions?


      Thanks.