Old JChem 4 Excel function not working

User bc3eb0a599

29-09-2009 20:28:13

Hi All:

I have some existing codes (see below) that now do not work with new JChemForExcel (1.1.2). Specifically, calling jchemExcel.ImportFile(file, sheet.Name) no longer works. Does anyone know if this function still supported. If not, what is the replacement new function?




    Dim file As String
    Dim wb As Workbook
    Dim sheet As Worksheet
    Dim addin As Office.COMAddIn
    Set addin = Application.COMAddIns("JChemExcel.Functions")
    Set jchemExcel = addin.Object
    'Open another workbook and make the 1st sheet active
    Set wb = Workbooks.Add
    Set sheet = wb.Sheets(1)
    ' Hide the metadata row by setting the height to 0
    sheet.Rows(2).rowHeight = 0
    ' Find the ChemCart path.
    file = ChemCart.GetPath
    If Len(Dir(file)) > 0 Then
        ' Import the file, delete, then close this book
        bRet = jchemExcel.ImportFile(file, sheet.Name)

        Kill file
        'Display error
        MsgBox "SDfile to import (" & file & ") not found."
    End If



ChemAxon 0e37943a96

30-09-2009 14:15:44


the API was not official in the previous versions (we have just included it as an example for you :)).

The new method name for the import from file function is (C# header):

ImportFromFile(string fileName, object workbookName, object worksheetName, object append)

Only the file name is mandatory. If the workbookname and worksheetname is not specified, it will import into the active ones. The append option does not work yet.


In 1.1.3 we are going to officially publish the APi together with documentation, and sample code in Java, .NET and VBA.

However from now on the interface is going to be backward compatible.






ChemAxon bd13b5bd77

10-03-2010 23:19:06

Please visit our download side:



containing some example how our new official API itnerface works.