Customize or Translate Content of Run-Time Messages
Custom run-time messages are not only possible in DoneEx VbaCompiler for Excel, they’re easy! DoneEx VbaCompiler allows you to show messages in your customer’s language. It also allows you to customize your personal message content to relate to your project.
To do that you just need to create your own ‘Custom Resource Dictionary’. You can find files with examples of such a dictionary in the ‘rsc’ sub-folder of the VbaCompiler for Excel installation folder.
Creating Your Own Run-Time Resource Dictionary
To create your own run-time resource dictionary, you need to copy one of file examples present in VbaCompiler for Excel installation folder into a location where you are going to work with the dictionary and then name the dictionary file as you wish. Open this copy in Microsoft Notepad and edit the resource values.
The Custom Resource Dictionary is a simple text file encoded in UTF-8 format. Your VBA code can use this dictionary of messages at run-time..
The content of the Custom Run-Time Resource Dictionary is implemented as collection of <RESOURCE_NAME>=<RESOURCE_VALUE> statements.
If you want to change a text value of a resource, then you need to rewrite the part to the right of the ‘=’ assignment sign with your own content. The whole text value must be in a single line without starting a new line. You can show some of the text resources in a multiple line message box. To start a new line in the text you need to insert the ‘\n’ symbol combination. While displaying, ‘\n’ will be converted to a new line transfer.
You can only edit the RESOURCE_VALUE part of each resource – that is the part that comes right after the ‘=’ symbol. If you edit the RESOURCE_NAME (the left part from the ‘=’ symbol) the resource dictionary will ignore this resource and VBA Compiler run-time library will use the default content for the message.
Be sure that you are saving your resource dictionary text file with UTF-8 encoding, double checking your “Save As” settings for your Custom Run-Time Resource Dictionary file as shown in the following image:
When you create your own resource dictionary you need to select the file in the ‘Resource Dictionary’ field in the compilation options form, as shown in the following image:
Template Tags for Custom Run-Time Messages
Sometime the run-time messages need information which is available only during run-time. There are Template Tags available in order to display this information.
A template tag is a reserved word written in capital letters and wrapped by the “<?” and “?>” strings.
All customized messages can use template tags. The corresponding, actual values replace the tags before the message appears.
Please note that not all tags may be available for every message content.
If some tag is not available, then there is nothing to substitute. That tag appears in the message as is.
<?AUTHOR_CONTACT?> – The content of ‘Author contact’ field from the VbaCompiler compilation option form.
<?COMPID?> – The computer ID of the computer where the application is.
<?TRIAL_DAYS_LEFT?> – The number of days left until the end of the trial period.
<?APPNAME?> – The content of the ‘Application Name’ field from the VbaCompiler compilation option form.
<?DATE_FROM?> – The date of the start of the usage period, fetched from the registration key.
<?DATE_TO?> – The date of the end of the usage period, acquired from the registration key.
<?WBKPATH?> – The path to the location of the current workbook with the compiled VBA code.
<?RNAME?> – The name of the registered customer, gathered from the registration key. If the registration key is not present, then the word “UNREGISTERED” will substitute the tag.
<?RMAIL?> – The e-mail of the registered customer, taken from the registration key. If the registration key is not present, then the word “UNREGISTERED” will substitute the tag.