XCell Compiler

  • Product
    • Home
    • News
    • Options Overview
    • Features By Licenses
    • Excel Formula Protection
    • Workbook Copy Protection
    • VBA Copy Protection
    • Custom Message Content
    • Bulk Registration Key Generator
  • Q&A
    • Install and Uninstall
    • Questions about trial version
    • Technical
    • Troubleshooting
    • Buying product
    • Updates
  • How-To
    • How to compile workbook to exe
    • Create registration key for compiled workbook
    • Create protected trial/demo workbook
    • Compile EXE for Excel 32 and 64 bit
    • Hide Excel on start
    • Keep compilaton options settings
    • Export/Import changed data
    • Set date limitation for workbook
    • Translate or change default messages
    • Runtime API References
    • Protect Workbook with Dongle
    • Compile Time Troubleshooting
  • Download
  • Order
  • Testimonials
  • Contact Us

XCell Compiler Runtime API References

DoneExCommand
DoneExInvalidate
DoneExCalculate
IsCompiled

DoneExCommand

For customers who are using VBA programming in their workbooks, the XCell Compiler contains the runtime Application Programming Interface (API), which allows access to the compiled EXE features which cannot be reached by standard Excel VBA commands.

The syntax of call the DoneEx Commands is the following:

Application.Run "DoneExCommand", <command code>, [optional parameter]

 

Where:

<command code> – the code of a command you want to use.

The third parameter is optional and depends on command code.

 

The following command codes are available:

 

1 – Data Export

This command exports changed data the same way as “Export Data” DoneEx menu item.

The third parameter in this command will be full path to the file where the exported data will be saved.

If the third parameter is missed or empty, then the file name will be requested with the Open File Dialog.

 

Example of usage:

Application.Run "DoneExCommand", 1, "c:\ExportData\MyAppChanges.dat"

or

Application.Run "DoneExCommand", 1

 

2 – Data Import

This command imports the .dat file with the exported data the same way as “Import Data” DoneEx menu item. The third parameter has to contain the path to the file with exported data.

 

Example of usage:

Application.Run "DoneExCommand", 2, "c:\ExportData\MyAppChanges.dat"

 

3 – Get Information

This command retrieves XCell runtime information.

The third parameter of the command is the mnemo code of information you would like to retrieve:

 

“rname” –  the name of registered customer.

“rmail” – the registered email.

“compid” – the computer id of the computer where application is started.

 

All three mnemo codes will work only if the EXE was compiled with Hardware Locking option ON and the EXE is started with a valid registration key.

“dateto” – the expiration date which is set during compilation with the “Limit expiration date period” option or from the registration key file.

“appname” – the Application Name. This is the content of the “Application Name” field on XCell Compiler compilation form

 

“appver” – the application version from the XCell Compiler compilation form.

“exepath” – the full path to the compiled EXE.

“cmdline” – the full command line with all parameters which were used during start of compiled EXE.

Examples of usage:

CustomerName = Application.Run("DoneExCommand", 3, "rname")
CustomerEMail = Application.Run("DoneExCommand", 3, "rmail")
ComputerID = Application.Run("DoneExCommand",3, "compid")

 

5 – Show EULA

Sometimes it is required to show the workbook author the EULA . You may do it with the command code 5.

The third parameter is not used.

 

Example of usage:

Application.Run "DoneExCommand", 5

 

6 – Collected Data Export

This command works the same way as Data Export, except that the changed data will be exported  from all working sessions of the EXE.

 

Example of usage:

Application.Run "DoneExCommand", 6, "c:\ExportData\MyCollectChanges.dat"

 

8 – Set Excel Solver Calculation Mode

This command enables/disables the flag that toggles Excel Solver calculation mode when Excel Solver is called from VBA code.

 

Example of usage:

Application.Run "DoneExCommand", 8, true ' enable
<VBA code to involve Excel Solver>
Application.Run "DoneExCommand", 8, false ' disable

 

9 – Show Application About Box.

This command shows the compiled application’s about box.

 

Example of usage:

Application.Run "DoneExCommand", 9

 

Returns

The DoneExCommand returns following values:

0 – no error,

-1 –  undefined error,

-2 –  command code is incorrect,

-3 –  parameter error.

 

Remark

The DoneExCommand will not work in the original Excel workbook without compilation.

To prevent errors (which may appear in original workbook after you insert DoneEx runtime commands) you need to prevent the usage of DoneExCommand by On Error Resume Next statement.

 

Example:

On Error Resume Next

Application.Run "DoneExCommand", 5

 

If usage of the “On Error Resume Next” statement is not suitable for your VBA code, then you may need to check if that workbook is working in compiled mode by using the following function:

 

Function IsCompiled() As Boolean

IsCompiled = Not IsError(ExecuteExcel4Macro("DoneExCalcTime"))

End Function

 

Example of usage:

If IsCompiled() Then

Application.Run "DoneExCommand", 5

End If

DoneExInvalidate

XCell runtime has its own calculation engine which is independent from Excel.

Sometimes actions from the VBA code may cause changes that are reflected in Excel but not in XCell runtime. As a result, you may see the difference in values between the original xls and the compiled EXE.

In such situations you need to use the XCell compiler runtime command DoneExInvalidate .

The DoneExInvalidate reflects all values of the selected region in the Excel grid into the XCell runtime engine.

 

VBA Syntax:

 

Application.Run "DoneExInvalidate", <Range>

 

Where <Range> may be present as a text string like “Sheet1!A1:Z100” or as an Excel VBA Range object.

 

Example of usage:

Sub SortAscending()
    Dim rng As Range
    Set rng = Application.Range("D1:D7")
    rng.Select
    rng.Sort rng, Order1:=xlAscending
    Application.Range("D1").Select
    If IsCompiled() Then 'if compiled EXE mode
        'invalidate the region inside XCell calc engine
        Application.Run "DoneExInvalidate", rng
       'run XCell recalculation for invalidated values
       Application.Run "DoneExCalculate"
    End If
End Sub

 

You can find the VBA code for the “IsCompiled” function implementation here.

DoneExCalculate

XCell runtime has its own calculation engine which is independent from Excel.

DoneExCalculate command involves the recalculation of the changes in XCell calc engine.

 

VBA Syntax:

Application.Run "DoneExCalculate"

 

Usually the DoneExCalculation is involved in the Excel’s Application.Calculate call and does not need to be called directly.

IsCompiled

How to recognize that the workbook is working in compiled mode.

In VBA:
You may use the following function in your VBA code:

'IsCompiled returns TRUE when it runs in compiled EXE and FALSE in original workbook
Function IsCompiled() As Boolean
     On Error Resume Next
     IsCompiled = Not IsError(ExecuteExcel4Macro("DoneExCalcTime"))
End Function

In a cell:
Use function INFO with the parameter “isexe”

INFO(“isexe”) – returns #VALUE! in original xls and TRUE in compiled EXE.

VBA Compiler Available

DoneEx Vba Compiler for Excel
  • XCell Compiler
    • News
    • Options Overview
    • Features by licenses
    • Excel Formulas Protection
    • Workbook Copy Protection
    • VBA code copy protection
    • Custom Message Content
    • Bulk RegKey Generator
    • Privacy Policy
  • How-To
    • Compile workbook to EXE
    • Use registration key tool
    • Create trial/demo workbook
    • Select target Excel bitness
    • Hide Excel on start
    • Options settings configuration
    • Export/import changed data
    • Date limitation options
    • Translate messages
    • Runtime API References
    • Protect Workbook with Dongle
    • Compile Time Troubleshooting
Copyright 2005-2024 © DoneEx LLC. All Rights Reserved.