Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

unable to cast com object error

Community Beginner ,
Jun 15, 2018 Jun 15, 2018

I have a script that has been working for years, then I think there was a windows update that broke it.  I am using vb.net and InDesign 2018.

The error I get is 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)).

This is only happening on some of my client machines that run this.  My development machine does not break.  The script is very simple it is just resizing text in text frames, so I will just post where it is failing (when it references the document).  It seems like the InDesign dll registrations in Windows have broken somehow.

Dim myIndesign As InDesign.Application = CreateObject("InDesign.Application.CC.2018")

myDocument = myIndesign.ActiveDocument

        myLayer = myDocument.Layers.Item("Layer 1")

        myTextFrames = myLayer.TextFrames.Count

        For myCounter = 1 To myTextFrames

Thanks for any help.

TOPICS
Scripting
5.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jun 18, 2018 Jun 18, 2018

The link to the thread about registering the tlb file kind of worked.  If any of you have the problem again on Windows 10, here is what I had to do.

1. copy the regtlibv12.exe from a Windows 7 computer because it is not there in Windows 10

2. run the command C:\Windows\Microsoft.NET\Framework\v4.0.30319\regtlibv12.exe "C:\ProgramData\Adobe\InDesign\Version 9.0\de_DE\Scripting Support\9.0\Resources for Visual Basic.tlb"

3.  delete the resources.tlb file from c:\programdata\adobe\indesign\{versionx}

...
Translate
Guru ,
Jun 17, 2018 Jun 17, 2018

To quote myself Re: InDesign CS6 scripts don't work on CC anymore

It sounds like you need to regenerated the .tlb files which are store somewhere like C:\ProgramData\Adobe\InDesign\Version 9.0\en_IL\Scripting Support\9.0

See more there, also see Re: Create Indesign.Application CC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 18, 2018 Jun 18, 2018

The link to the thread about registering the tlb file kind of worked.  If any of you have the problem again on Windows 10, here is what I had to do.

1. copy the regtlibv12.exe from a Windows 7 computer because it is not there in Windows 10

2. run the command C:\Windows\Microsoft.NET\Framework\v4.0.30319\regtlibv12.exe "C:\ProgramData\Adobe\InDesign\Version 9.0\de_DE\Scripting Support\9.0\Resources for Visual Basic.tlb"

3.  delete the resources.tlb file from c:\programdata\adobe\indesign\{versionx}\en_us\scripting support\{version}

4. run InDesign as administrator.

Now my script works again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 18, 2018 Jun 18, 2018

Did you try just deleting the .tbl so that it regenerates itself and in didn't work so you used the regtlibv12.exe method or did you go strait for the regtlibv12.exe method?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 18, 2018 Jun 18, 2018

I tried deleting the tlb first, but that didn't take care of the issue.  That has resolved my issue in the past, but this time after the most recent set of windows updates it didn't seem to take care of the issue w/o registering the tlb.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 18, 2018 Jun 18, 2018

Thanks, I marked your answer as correct, you can now mark mine as helpful

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 22, 2023 Jun 22, 2023

The above issue happened to me. There is no such C:ProgramData folder not found in my system. I have using VS2019 and adobe Indesign CS6. I want to open a IDML file and load an XML. Kindly suggest me. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 23, 2023 Jun 23, 2023

Did you try locating the tlb file on your machine, deleting it if found, and then lauching InDesign as admin so that the tlb file is regenerated? If this does not help you then create a new post as this is a very old post and you would not get much help on this one.

-Manan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2023 Jun 24, 2023

I'm pretty sure running InDesign as admin ONLY re-creates TLB file - but doesn't register it in the system. 

 

@Aysha27550661f9sm this is original place for the tool - links to ZIPs no longer work:

 

http://www.vbaccelerator.com/home/VB/Utilities/Type_Library_Registration_Utility/VB6_Register_TypeLi...

 

And here is a copy with working ZIPs:

 

https://github.com/tannerhelland/vbAccelerator-Archive/tree/master/VB/Utilities/Type_Library_Registr...

 

Remember to run this utility as admin to let it properly register TLB file in the system. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2023 Jun 25, 2023
LATEST

Thanks for the insight @Robert at ID-Tasker. In my limited experience so far with using InDesign tlb file, I never had to register it explicitly.

-Manan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines