How to use the Adobe Indesign API in VB.Net

I have a sample to add to excel: I create an InDesign.Application object

Dim myInDesign As InDesign.Application Dim myDoc As InDesign.Document Dim myPage As InDesign.Page myInDesign = CType(Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Application"), True), InDesign.Application) myDoc = myInDesign.Documents.Add myDoc = myInDesign.ActiveDocument 

InDesign opens, but the add-in shows an error:

 `myInDesign = CType(Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Application"), True), InDesign.Application)` 

Error Content:

 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)). 

Why? Can you help me?

+4
source share
1 answer

Have you added a link to the InDesign type library using the vb.net com interface?

Open the link bar in Visual Studio and select the “COM” tab and find InDesign in your list. By default it will be Copy Local = False .

Now you can use COM functions just like you wrote vbs.

+3
source

All Articles