Skip to main content
April 6, 2011
Question

InDesign 7.0 breaks Visual Basic reference

  • April 6, 2011
  • 3 replies
  • 13573 views

I've previously posted this to the Indesign SDK & Scripting forums, but haven't gotten a reply.
I thought I'd try again, rephrasing it a bit.
When I installed Creative Suite 4, InDesign 6.0 installed a COM typelib for Visual Basic.
C:\ProgramData\Adobe\InDesign\Version 6.0\en_US\Scripting Support\6.0\Resources for Visual Basic.tlb

I am able to reference this from VB.NET Visual Studio 2010 and program against the InDesign scritping API like a charm - with full IntelliSense.

With Creative Suite 5 InDesign 7.0 I am unable to establish this reference from Visual Studio.
Visual Studio can't find the reference.

Any ideas?

This topic has been closed for replies.

3 replies

Participant
March 24, 2017

Old thread but save my life. I've been fighting with Indesign CS6 and Visual Studio 2015 for some time and thanks solution provided by jpatescwp I can run Indesign CS6 from Visual Basic. My code to run it is:

Dim myIndesignType As Type = Type.GetTypeFromProgID("Indesign.Application.CS6")

Dim myIndesign As InDesign.Application = Activator.CreateInstance(myIndesignType)

Thank You so much for sharing Your solution.

Participant
March 9, 2012

I successfully use this code in C# 4.0 (after importing the tlb file as InDesign)

using  System;//System.Activator,System.Type

Type inDesignAppType = Type.GetTypeFromProgID("InDesign.Application.CS5.5")??Type.GetTypeFromProgID("InDesign.Application.CS4");

InDesign.Application _app = (InDesign.Application)Activator.CreateInstance(inDesignAppType);

This works without running regtlib* as it doesn't rely on the CLSID

PS: regtypelibv12.exe lives in C:\Windows\Microsoft.NET\Framework\v4.0.30319 (on my machine)

PSS: regtypelib did not fix my class not registered issue with delphi

PSSS: the cs5.5 tlb has the WRONG CLSID! it registers with windows using {11B39EA8-97C0-48B6-8BD2-4AA6632F8D9E} (not {296CAEB5-C99C-4B3E-9359-6E7D6EAE71FC} which was imported from the tlb)

changing the CLSID in the imported file corrected this problem for me in delphi (which uses CreateComObject(CLSID) to create the com server) (i've reported the bug via the https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform)

PSSSS: you /could/ call CLSIDFromProgID() to get the correct CLSID if you are working with win32

Harbs.
Legend
April 6, 2011

One request is more than enough. If anyone has an answer for you, they will respond.

Please DO NOT repeat your question in every thread on this (and other) forum(s). I'm deleting the duplicates.

Thank you,

Harbs

(I don't know the answer to your question. Very few of us use .NET with InDesign. It's not officially supported...)

April 6, 2011

I reposted my request as replies to two specfic people who had respond knowledgably to similiar questions on older, similar threads. I was hoping as a result my question would reach them directly.  You're right, there's a paucity of knowledge about interactiing with Adobe products with Microsoft development tools.

Known Participant
April 8, 2011

Hi,

It is very true that Adobe seems very Microsoft-hostile when it comes to development tools. Which is curious, because they use Windows to develop stuff, so perhaps they're just Windows scripting hostile. My Windows developer friends (I'm mostly a Mac guy) laugh at me when I tell them I have to use COM technology to talk to InDesign, but that's just the way it is.

In any event, CS5 installs a TLB file on my Win7 system here:

C:\ProgramData\Adobe\InDesign\Version 7.0\en_US\Scripting Support\7.0\Resources for Visual Basic.tlb

Unfortunately, if you try to add this as a reference to a VS2010 project, Visual Studio tells you that the reference could not be added.

You can try what it says on page 13 of the InDesignCS5_ScriptingGuide_VB, which is this:

Set myApp = CreateObject("InDesign.Application")
Rem Publish the InDesign CS3 type library (version 5.0 DOM)
myApp.PublishTerminology(5.0)

This fails on my system unless I make the argument to CreateObject "InDesign.Application.CS5" and then it works. BUT, the TLB it creates is also not recognized by Visual Studio.

I think this should be filed as a bug against CS5.

Also note the comment in the code above that references CS3; it seems that Ole wasn't paying a lot of attention to Windows support when he was editing this document.

So, bottom line, I think we're out of luck as far as having an object browser friendly listing of InDesign's scripting on Windows. However, it still works. For example, this code works:

        Dim myApp As Object
        myApp = CreateObject("InDesign.Application.CS5")
        Dim myDoc As Object
        myDoc = myApp.documents.add()
        myDoc.textFrames.add()

You sacrifice quite a lot in Intellisense and debugging by not having the object model around, but you can still drive InDesign.

Hope this helps.

-Chuck