tranthanhan1962 > 16-01-19, 04:39 PM
MTNQ > 26-01-19, 05:28 PM
tranthanhan1962 > 26-01-19, 06:07 PM
Option Compare Database
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As Long
Private Declare PtrSafe Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Public Function msgBoxUni(ByVal PromptUni As Variant, Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, Optional ByVal TitleUni As Variant = vbNullString) As VbMsgBoxResult
'BStrMsg,BStrTitle : La chuoi Unicode
Dim BStrMsg, BStrTitle
'Hàm StrConv Chuyen chuoi ve ma Unicode
BStrMsg = StrConv(PromptUni, vbUnicode)
BStrTitle = StrConv(TitleUni, vbUnicode)
msgBoxUni = MessageBoxW(GetActiveWindow, BStrMsg, BStrTitle, Buttons)
End Function
MTNQ > 26-01-19, 10:34 PM
Option Compare Database
#If VBA7 Then
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As LongPtr
Private Declare PtrSafe Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal wType As Long) As LongPtr
#Else
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal wType As Long) As Long
#End If
Public Function msgBoxUni(ByVal PromptUni As Variant, Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, Optional ByVal TitleUni As Variant = vbNullString) As VbMsgBoxResult
msgBoxUni = MessageBoxW(GetActiveWindow, StrPtr(PromptUni), StrPtr(TitleUni), Buttons)
End Function
tranthanhan1962 > 27-01-19, 07:04 AM
MTNQ > 27-01-19, 08:27 AM
MTNQ > 27-01-19, 08:42 AM
Option Compare Database
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As Long
Private Declare PtrSafe Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal wType As Long) As Long
Public Function msgBoxUni(ByVal PromptUni As Variant, Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, Optional ByVal TitleUni As Variant = vbNullString) As VbMsgBoxResult
msgBoxUni = MessageBoxW(GetActiveWindow, StrPtr(PromptUni), StrPtr(TitleUni), Buttons)
End Function
msgBoxUni = MessageBoxW(GetActiveWindow, StrPtr(PromptUni), StrPtr(TitleUni), Buttons)
mrsiro > 27-01-19, 12:19 PM
MTNQ > 27-01-19, 02:21 PM
(27-01-19, 07:04 AM)tranthanhan1962 Đã viết: MTNQ ơi! Bị lỗi!
Option Compare Database
#If VBA7 Then
' Code is running in the new VBA7 editor
#If Win64 Then
' Code is running in 64-bit version of Microsoft Office
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As Long
Private Declare PtrSafe Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As LongPtr, ByVal lpCaption As LongPtr, ByVal wType As Long) As Long
#Else
' Code is running in 32-bit version of Microsoft Office
Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As Long
Private Declare PtrSafe Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal wType As Long) As Long
#End If
#Else
' Code is running in VBA version 6 or earlier
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function MessageBoxW Lib "user32" (ByVal hwnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal wType As Long) As Long
#End If
Public Function msgBoxUni(ByVal PromptUni As Variant, Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, Optional ByVal TitleUni As Variant = vbNullString) As VbMsgBoxResult
msgBoxUni = MessageBoxW(GetActiveWindow, StrPtr(PromptUni), StrPtr(TitleUni), Buttons)
End Function
Sub testMSBox()
msgBoxUni ChrW(272) & "ây là MsgBox Ti" & ChrW(7871) & "ng Vi" & ChrW(7879) & "t!", vbInformation, "MsgBox Ti" & ChrW(7871) & "ng Vi" & ChrW(7879) & "t!"
End Sub
tranthanhan1962 > 27-01-19, 07:18 PM