Skip to main content
Participant
August 28, 2020
Answered

How to solve 0x80004002 error on InDesign 2020 COM with C#?

  • August 28, 2020
  • 2 replies
  • 845 views

Hi there,
I am trying to connect my C# apllication with the InDesign, but i am getting this error:

 

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: Não há suporte para esta interface (0x80004002 (E_NOINTERFACE)).

 

I found this solution, Extracting InDesign CS4 Graphics using C# and COM  but I don't have any file tlb or the Scripting Support folder...

Does somebody knows how to solve this problem on InDesign 2020 COM with C#?

There is my code:

 

public void IndesignFile(){
   Type inDesignAppType = Type.GetTypeFromProgID("InDesign.Application.2020");
   InDesign.Application myInDesign (InDesign.Application)Activator.CreateInstance(inDesignAppType);
   var myString = myInDesign.DoScript("return \"My String\"", InDesign.idScriptLanguage.idJavascript, new object[] { "" });
}

 

Could anybody help me, please?

 

This topic has been closed for replies.
Correct answer Manan Joshi

Launch InDesign as admin user, that forces creation of tlb file many times when its not already present

-Manan

2 replies

daitranthanhoa
Inspiring
August 31, 2020

you can try this code:

 Type oType = Type.GetTypeFromProgID("InDesign.Application.2020");
dynamic myIndesign = Activator.CreateInstance(oType);

Manan JoshiCommunity ExpertCorrect answer
Community Expert
August 28, 2020

Launch InDesign as admin user, that forces creation of tlb file many times when its not already present

-Manan

-Manan