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.

Participating Frequently
July 5, 2011

I found the solution, thanks to a suggestion in this post:

http://forums.adobe.com/message/2984975

Launch InDesign by right-clicking and choosing "Run as Administrator" (I assume you're on Windows 7, don't know if this trick works on earlier versions).

This allows InDesign to make appropriate changes to the registry and who knows what else in the system.

You can then quit InDesign and launch it normally (I don't like running things as Admin as a rule).

After this, as if by magic, the "Adobe InDesign CS5 Type Library" appears in the COM tab in Visual Studio's "Add Reference" dialog. You can add it to your project and then, as the Guardian of Forever says on Star Trek, "All Is As It Was."

Hope this helps.

-Chuck

EDIT: forgot to mention that BEFORE you run InDesign as admin, you need to go to this directory:

C:\ProgramData\Adobe\InDesign\Version 7.0\en_US\Scripting Support\7.0

And DELETE (or rename) the file "Resources for Visual Basic.tlb"

Otherwise this file doesn't get regenerated, and you can wind up with bad COM information. In my case, it resulted in errors like this (from VS C# 2010):

"Unable to cast COM object of type 'System.__ComObject' to interface type 'InDesign.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ABD4CBB2-0CFE-11D1-801D-0060B03C02E4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

The best thing about Windows is how much fun you can have exploring while you're supposed to be actually doing work.

Message was edited by: cweger79


Yes, I love that about Windows too.

Thanks, John,  for the quick reply. (Especially on a holiday!)  I tried deleting the tlb (from both locations:  \users\mark\appdata\local\adobe\inDesign\version 7.5\en_US\Caches\Scripting Supoort\7.5\  AND c:\ProgramData\Adobe\InDesign\Version 7.5\en_US\Scripting Support\7.5. In Design restores both of these files (and they both show up in the reference browser), but I get the same message.  I tried using VS10 and Got a little more description:

Retrieving the COM class factory for component with CLSID {296CAEB5-C99C-4B3E-9359-6E7D6EAE71FC} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).