'COPY TOÀN BỘ CODE TRONG FILE NÀY VÀO ĐẦU MODULE VBA

Option Explicit
'Author : Nguyen Duy Tuan
'E.Mail : tuanktcdcn@yahoo.com
'Tel    : 0904.210.337
'Website: www.bluesofts.net

#If VBA7 Then
'Declare PtrSafe Sub...
Declare PtrSafe Function VNDW Lib "AccHelper.xll" Alias "VND" (ByVal Amount As Double, _
                                        Optional ByVal OutputType As Integer = 3, _
                                        Optional ByVal Unit1 As Variant = "", _
                                        Optional ByVal Unit2 As Variant = "", _
                                        Optional ByVal MUnit2 As Long = 1, _
                                        Optional ByVal HasGroupingSymbol As Boolean = False) As Variant
'OutputType = 1 => TCVN3(ABC)
'OutputType = 2 => VNI
'OutputType = 3 => UNICODE (Ngam dinh)

Declare PtrSafe Function USDW Lib "AccHelper.xll" Alias "USD" (ByVal Amount As Double, _
                                        Optional ByVal Unit1 As Variant = vbNullString, _
                                        Optional ByVal Unit2 As Variant = vbNullString, _
                                        Optional ByVal MUnit2 As Long = 1, _
                                        Optional ByVal HasGroupingSymbol As Boolean = False) As Variant

Declare PtrSafe Function Num2StrW Lib "AccHelper.xll" Alias "Num2Str" (ByVal Amount As Double, _
                                        Optional ByVal LangType As Integer = 2, _
                                        Optional ByVal Unit1 As Variant = vbNullString, _
                                        Optional ByVal Unit2 As Variant = vbNullString, _
                                        Optional ByVal MUnit2 As Long = 1, _
                                        Optional ByVal HasGroupingSymbol As Boolean = False) As Variant

'LangType = 1 => Viet Nam
'LangType = 2 => English

Declare PtrSafe Function ToUNCW Lib "AccHelper.xll" Alias "UNC" (ByVal Text As Variant, _
                                        Optional ByVal InputType As Integer = 1) As Variant
'InputType = 1  TCVN3>>UNICODE (ngam dinh)
'InputType = 2    VNI>>UNICODE

#Else

Declare Function VNDW Lib "AccHelper.xll" Alias "VND" (ByVal Amount As Double, _
                                        Optional ByVal OutputType As Integer = 3, _
                                        Optional ByVal Unit1 As Variant = vbNullString, _
                                        Optional ByVal Unit2 As Variant = vbNullString, _
                                        Optional ByVal MUnit2 As Long = 1, _
                                        Optional ByVal HasGroupingSymbol As Boolean = False) As Variant
'OutputType = 1 => TCVN3(ABC)
'OutputType = 2 => VNI
'OutputType = 3 => UNICODE (Ngam dinh)

Declare Function USDW Lib "AccHelper.xll" Alias "USD" (ByVal Amount As Double, _
                                        Optional ByVal Unit1 As Variant = vbNullString, _
                                        Optional ByVal Unit2 As Variant = vbNullString, _
                                        Optional ByVal MUnit2 As Long = 1, _
                                        Optional ByVal HasGroupingSymbol As Boolean = False) As Variant

Declare Function Num2StrW Lib "AccHelper.xll" Alias "Num2Str" (ByVal Amount As Double, _
                                        Optional ByVal LangType As Integer = 2, _
                                        Optional ByVal Unit1 As Variant = vbNullString, _
                                        Optional ByVal Unit2 As Variant = vbNullString, _
                                        Optional ByVal MUnit2 As Long = 1, _
                                        Optional ByVal HasGroupingSymbol As Boolean = False) As Variant

'LangType = 1 => Viet Nam
'LangType = 2 => English

Declare Function ToUNCW Lib "AccHelper.xll" Alias "UNC" (ByVal Text As Variant, _
                                        Optional ByVal InputType As Integer = 1) As Variant
'InputType = 1  TCVN3>>UNICODE (ngam dinh)
'InputType = 2    VNI>>UNICODE

#End If

Sub Test()
    Dim s As String
   s = VNDW(102300, 1, "U1", "U2", 1, True)
   Debug.Print s
End Sub
