3 Replies Latest reply on Apr 21, 2008 2:19 AM by [Jongware]

    Indesign CS3 and VBA

      Hi,
      I'm very, very new to scripting.
      I have created a template in Indd which I want to automate. The automation involves having a panel pop up where users can input name of file, type of file, etc. I have found a Word form which is practically what I want, but it is VBA and consists of a .frm and .frx files.

      Can I use this form and how ?

      thanks in advance.
        • 1. Re: Indesign CS3 and VBA
          [Jongware] Most Valuable Participant
          Well, yes, but it is not as easy as you might hope.

          First you need to activate the ID Type Library for VBA. That's done in a VBA window (if you don't have one, stop reading :-)). Select Tools -> References, and you get a nice long list of all Type libs on your system. Scroll down until you see "Adobe InDesign CS3 Type Libary", and check the lil' checkbox.
          Now you can use any ID scripting method, object, and property as a valid VBA one!

          At the start of every script you need to state that the target is ID, that's with the magic invocation

          >Dim myInDesign As InDesign.Application

          >Set myInDesign = CreateObject("InDesign.Application.CS3")

          ... and you're off!
          Well, at least you can now
          i try
          if your form also works for ID.
          • 2. Re: Indesign CS3 and VBA
            Level 1
            Hi,
            Thanks for that, but I don't understand. The VBA already exits and works for a Word template, I need to make it work for an ID template, in ID, using a language able to be interpreted by ID.

            Or did I miss something ?
            Thanks.
            • 3. Re: Indesign CS3 and VBA
              [Jongware] Most Valuable Participant
              >Or did I miss something ?

              You're missing that Word and ID are two entirely different programs... The only factor they have in common is VBA -- which is "a language able to be interpreted by ID" (that's not actually true, but comes close enough).

              The fact that you got working code for Word does not automatically mean it can be easily adjusted to work in ID. As I stated

              >>Well, yes, but it is not as easy as you might hope.

              Your script probably consists of two parts: an input dialog, where the user inputs his stuff and presses an Okay button, and a processing part, where the data collected is written into a proper Word document. The former works totally independent of Word -- the dialog is purely a part of VBA. So it will do the same "in" InDesign. The latter interfaces with Word, even if it's only as 'simple' as writing a string of text. That part of the code need ID methods.

              Perhaps you should start with a less challenging project as your first.