2 Replies Latest reply on Jul 12, 2018 4:02 AM by John Galvin-Clare

    Visual Studio 2015 [VB] Scripting

    John Galvin-Clare



      I have a number of scripts I've written in VB 5.0, targeting CS2. We're now using a mix of CS2/4 and shortly plan to move to CS6 (not CC as we have some external plugins provided by a third party and need stability).

      My scripts create picture frames, populate them with EPS or pdf files, arrange them on a page and print them out for proofing and other purposes.

      I've now moved to Visual Studio 2015 which I understand is not great with Indesign scripting although the basics are working for me. Can anyone point me to a resource that would help? There seems to be issues with the way paramaters are passed.


      As an example:

         Private Sub btnTutorial_Click(sender As Object, e As EventArgs) Handles btnTutorial.Click

              Dim myIndesign As Object

              Dim MyDoc As Object

              Dim myTextFrame As Object


              myIndesign = CreateObject("InDesign.Application")

              myIndesign.DocumentPreferences.PageWidth = "80mm"

              myIndesign.DocumentPreferences.PageHeight = "150mm"

              myDoc = myIndesign.documents.add()

              myTextFrame = MyDoc.textFrames.add()


              myTextFrame.GeometricBounds("0mm", "0mm", "70mm", "60mm")


              myTextFrame.Contents = "Hello World."

          End Sub


      This code works apart from the line referencing GeometricBounds. I've tried various formats and this method compiles successfully but when I run it I get

      'Value doesn't fall within the expected range'. It looks like I'm passing something but what exactly?


      Any help or directions would be greatly appreciated.