Internal API

Back to index page

What is internal API?

Internal API is the JC4XL plug-in itself that implements and provides IJChemExcelAPI COM interface for VBA developers who want to reuse JC4XL functionalities from custom macro modules. In this way very easily anyone can create custom solutions inside Excel even from custom Add-ins. Internal API is recommended for manipulation of Workbooks, Worksheets inside the Excel instance where the macro module or Add-in is running from. For different JC4XL instance manipulations please see the External API sections below even if it is done from VBA module.

 

How to access it?

The internal API COM object is set normally on the Object property of the add-in.

Dim nativeInterface As Object

Dim objAddin As Office.COMAddIn

 

   'COM Add-in is the real Office plug-in loaded in at startup

   Set objAddin = Application.COMAddIns("JChemExcel.JChemExcelAddin")

   Set nativeInterface = objAddin.Object

 

How to call its interface?

To call it natively (recommended)

Calling the poor dispatch interface is the most common how macro module developers can use the API.

nativeInterface.ImportFromFile sFileName, …..

 

To call it with using the typed interface

If you choose this option the JChemExelCOMInterfaces library needs to be included by adding it via Tools/References in Visual Basic for Applications editor.

 

Menu.InternalAPI

 

AvailableRef.InternalAPI (1.1 Type Library from JC4XL 1.1.4)

 

Dim jeJchemForExcel As JChemExcelCOMInterfacesLib.IJChemExcelAPI
Set jeJchemForExcel = objAddin.Object
Call jeJchemForExcel.ImportFromFile( ……

 

The biggest benefit to use typed safe way of invoking the JC4XL API is that the built-in IDE provides intellisense (hints) about how to specify the method arguments. And any changes in the interface from version by version can be easily tracked.