Handling Translation when Customizing with VBA

David MeegoFrom the Translating Dexterity Applications Series

The final topic in the series is one that was added later after I was asked about how to handle translated applications when writing customizations.

Most code would work fine as it is independent of the language. However, it is common in Visual Basic for Applications (VBA) customizations to read the prompt from a dialog using the Window_AfterModalDialog() event and take action based on the prompt text.  On a translated system this text will differ.

The solution is that you would need to look for the prompt in each language.  You can use a select case statement as shown in the US English versus International English example below:

VBA Code Example

The easiest method of capturing the exact text to use is by placing a breakpoint at the beginning of the select case statement. Then once the code is paused, use the immediate window to type "? PromptString" and then press Enter.  You can the cut and paste the prompt into the code.

Advanced Method: If you want to try a more advanced method, it would be possible to get the message resource (if you know the Message ID) from Dexterity using passthrough sanScript and returning the result to the SY_User_Object_Store (SY90000) DUOS table and then reading the DUOS from VBA. This example demonstrates the techniques involved: Hybrid - Changing Screen Colours Depending on Company Example. Comparing against the message from Dexterity itself will always work regardless of language.

This is a good method of having a single set of code that will work for all languages. However, it is likely that each language is going to have its own application folder and so you can have separate code for each language as well.

Have fun customizing.


Comments (2)

  1. Vaidy says:

    Hi David,

    It’s been a series of very useful information and concepts. Thank you for consolidating all these information and present it to us.

    And for this last article, a special Thanks, as this is imperative to consider on our customizations.



Skip to main content