Skip to main content
New Participant
October 18, 2019
Question

InDesign CC and Excel Scripting, Type definition in VBA

  • October 18, 2019
  • 3 replies
  • 3720 views

for years now I am using VBA scripts in Microsoft Excel to control InDesign. I used the code:

Dim InApp as InDesign.Application

Set InApp = CreateObject("InDesign.Application")

 

but now in InDesign CC 2019 this is a 'type mismatch' error. It works if I do:

Dim InApp as Object

Set InApp = CreateObject("InDesign.Application")

 

But then of course I do not have any type information in the debugging view and so on. This is extremely annoying, as I have a lot of objects like InDesign.Font, InDesign.Table, InDesign.Swatches etc.

In Excel I think I have the correct reference to the type library "Adobe InDesign CC 2019 Type Library" located at c:\ProgramData\Adobe\InDesign\Version 14\...

How to get this set up properly?

This topic has been closed for replies.

3 replies

New Participant
March 10, 2020

Hey guys

How are you ?
I need some help to use Indesign with VisualBasic code
I an using MAC, so ... i don't know if it's possible
The library  do not exist in VBA reference

I really need some helps
I want to use VBA to open an Indesign files, and import some text and image in a template

Thanks for your help guy

Erwan

Kasyan Servetsky
Brainiac
March 10, 2020

It's impossible to use VBA on MAC — it's for Windows only. You need Apple Script for this.

Alternatively, you can use a 'JavaScript + Apple Script' approach (my favorite): execute AS from InDesign's JS via doScript() method, sending parameters (arguments) and getting back results if necessary.

New Participant
March 10, 2020

Hi Kasyan 

 

thank you very much for your answer

i am surprised because I am using VBA on excel on Mac 

i can open the Visual Basic editor and have already put some code that working fine 

 

so maybe it's because there was a recent update on MAC ? 
Somebody else to find this library on Mac ? 

thanks 😊 

New Participant
October 18, 2019

seems I found it after hours.

I deleted the .tlb type file, started InDesign as administrator, closed it, started InDesign normally again. This recreates the .tlb file yet again, but something else does happen such that it works now. Very dumb indeed, I remember to have read about this somewhere a long time ago for an older version of InDesign, seems not to be fixed yet.

Kasyan Servetsky
Brainiac
October 18, 2019

I wrote about the problem a while ago.