You are here MsgBox with multiple language in VBA

MsgBox with multiple language in VBA

Function MsgBoxW of BSAC allows display unicode with many languages in VBA. You only define button text in code or in spreadsheet.

1. Make sure you have installed Add-in A-Tools or BSAC.ocx

2. In VBA,menu Tools->References,... check Bluesofts ActiveX Controls (BSAC.ocx)

3. Define language for button text of MsgBoxW in spreadsheet
4. Create a module in VBAProject and copy codes bellow:
SOURCE CODE run MsgBoxW with multiple language:
'-----------BEGIN COPY----------------------------------
Option Explicit
'In VBA,menu Tools->References,... check Bluesofts ActiveX Controls (BSAC.ocx)
'Author: Nguyen Duy Tuan - -
Public Const r_Ok = 3
Public Const r_Cancel = 4
Public Const r_Yes = 5
Public Const r_No = 6
Public Const r_Ignore = 7
Public Const r_Retry = 8
Public Const r_Help = 9
Public Const r_Abort = 10
Public Const r_Continue = 11
Sub TestMsgBoxWithLanguage()
    SaveButtons 'Save prev language
    On Error GoTo lbEndSub
    'Define button text
    Dim col_Lan As Long, sh As Worksheet
    Set sh = Sheets("Sheet1")
    col_Lan = sh.Range("A1").Value + 1
    SetButtonText ID_OK, sh.Cells(r_Ok, col_Lan).Value
    SetButtonText ID_CANCEL, sh.Cells(r_Cancel, col_Lan).Value
    SetButtonText ID_YES, sh.Cells(r_Yes, col_Lan).Value
    SetButtonText ID_NO, sh.Cells(r_No, col_Lan).Value
    SetButtonText ID_IGNORE, sh.Cells(r_Ignore, col_Lan).Value
    SetButtonText ID_RETRY, sh.Cells(r_Retry, col_Lan).Value
    SetButtonText ID_HELP, sh.Cells(r_Help, col_Lan).Value
    SetButtonText ID_ABORT, sh.Cells(r_Abort, col_Lan).Value
    SetButtonText ID_CONTINUE, sh.Cells(r_Continue, col_Lan).Value
    'Replace original MsgBox with MsgBoxW in BSAC.ocx
    MsgBoxW sh.Cells(13, col_Lan).Value, _
            vbYesNoCancel + vbMsgBoxHelpButton + vbInformation, , strUNICODE
    RestoreButtons 'Restore old button text
End Sub
'----------------END COPY