2 Replies Latest reply on Jul 14, 2014 4:49 AM by rjbull

    VB Script for CS5

    rjbull Level 1

      I am looking for help to update a VB script from InDesign CS2 to InDesign CS5. I have hit a snag with placing a graphic in a named or labeled Frame or box. It has been a few years since I have done much scripting so I am out of the loop of new things.

      If I select the graphic box the script will place the graphic.The line that is commented out.

      But when I try to place it using the label name it fails with error The requested member of the collection does not exist with code 800A7708


      Here is a little of the code where I am having trouble.



      Set fso = CreateObject("Scripting.FileSystemObject")

      Set wshShell = WScript.CreateObject ("WScript.Shell")



      Set myInDesign = CreateObject("InDesign.Application.CS5")



      set myDocument = myInDesign.Documents(1)


      Set myPage = myDocument.Pages.Item(1)



      ''set MyRectangle = myDocument.Selection.Item(1)



      set MyRectangle = myDocument.Pageitems.item("A1")



      MyRectangle.Place "I:\5_EVOReady\3940249.pdf"



      This code does work properly in Indesign CS2

      Any thoughts or suggestions will be appreciated .

        • 1. Re: VB Script for CS5
          Laubender Adobe Community Professional & MVP

          @rjbull – yes, "something has changed". Since InDesign CS5 you cannot adress the label like that anymore. There is a new property, name, and with item("A1") or itemByName("A1") you'll address the first found pageitem with that particular name in the pageitem collection.


          I'm talking ExtendScript here, not VB Script, but it should be quite the same. Syntax is a bit different, but the basics are the same.


          Unfortunately there is no itemByLabel() method or function. So you have to loop through all the pageitems searching for a pageitem with the label of value "A1".


          See the following posts about that problem and some more issues:



          With CS5, some things have changed

          Oct 3, 2010 1:50 AM

          With CS5, some things have changed



          • 2. Re: VB Script for CS5
            rjbull Level 1

            Thanks, that got me going again.