MALICIOUS
250
Risk Score
Heuristics 8
-
VBA project inside OOXML medium 6 related findings OOXML_VBADocument contains a VBA project — VBA macros present
-
WScript.Shell usage critical OLE_VBA_WSCRIPTWScript.Shell usageMatched line in script
s = s & "Set oShell = CreateObject(""WScript.Shell"")" & vbCrLf -
CreateObject call high OLE_VBA_CREATEOBJCreateObject callMatched line in script
Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") -
GetObject call high OLE_VBA_GETOBJGetObject callMatched line in script
s = s & "Set objExcel = GetObject( , ""Excel.Application"") " & vbCrLf -
VBA polls global keyboard state (keylogger) high OLE_VBA_KEYLOGGER_SPYWAREThe macro declares or calls a Win32 keystroke-monitoring API (GetAsyncKeyState, SetWindowsHookEx WH_KEYBOARD, or GetKeyboardState) to capture keystrokes system-wide. No legitimate document automation polls global key state; this is the core of a VBA keylogger, usually paired with active-window capture (GetForegroundWindow) and a log file. A high-confidence spyware behaviour independent of any download / Shell evidence.Matched line in script
Private Declare PtrSafe Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As LongPtr, ByVal hmod As LongPtr, ByVal dwThreadId As Long) As LongPtr -
VBA p-code auto-exec with execution tokens high OLE_VBA_PCODE_AUTOEXEC_EXECTriggers on the COMBINATION of two tokens co-occurring in the same compiled VBA/cache stream: an auto-execution entry point (Auto_Open / AutoOpen / Document_Open / Workbook_Open / Auto_Close / AutoClose) AND a shell/download/object-execution token (Shell, CreateObject, GetObject, PowerShell, cmd.exe, URLDownloadToFile, WinHttp, XMLHTTP, ADODB.Stream, ShellExecute, ExecuteExcel4Macro). Neither token alone fires it — it is the pairing that flags p-code-only or source-extraction-failure macro documents where the visible VBA source is unavailable. The matched tokens are named in the detail line below.
-
Environ() call (env variable access) low OLE_VBA_ENVIRONEnviron() call (env variable access)Matched line in script
enviro = CStr(Environ("APPDATA")) & "\KTExcel\" -
Embedded URL info EMBEDDED_URLOne or more URLs were extracted from the document. The URL itself is not a detection — see the per-URL labels for which channel (macro, JS, link annotation, document body, ...) reached each URL.URL https://docs.google.com/forms/d In document text (OOXML body / shared strings)
- https://docs.google.com/spreadsheets/d/1EGb4WAVjFUA5s8NhjZZsr7E9oq_GBI0y68ZU0iyOFzM/edit#gid=408663087In document text (OOXML body / shared strings)
- http://ktexcel.wapsite.me/indexIn document text (OOXML body / shared strings)
- https://docs.google.com/spreadsheets/d/1K3VJcVM2t1-w8TSUj6DiUNvLMqohkDhB_vp1VwtvrNE/export?format=csv&id=1K3VJcVM2t1-w8TSUj6DiUNvLMqohkDhB_vp1VwtvrNEIn document text (OOXML body / shared strings)
- https://docs.google.com/spreadsheets/d/11r2N1XNJrvcfmT_fwb06uiQDl1jGu63yMKZs_FyzT-E/export?format=tsv&id=11r2N1XNJrvcfmT_fwb06uiQDl1jGu63yMKZs_FyzT-Ex�In document text (OOXML body / shared strings)
- http://ns.useplus.org/ldf/xmp/1.0/In document text (OOXML body / shared strings)
- http://www.w3.org/1999/02/22-rdf-syntax-ns#In document text (OOXML body / shared strings)
- http://ns.adobe.com/photoshop/1.0/In document text (OOXML body / shared strings)
- http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/In document text (OOXML body / shared strings)
- http://xmp.gettyimages.com/gift/1.0/In document text (OOXML body / shared strings)
- http://purl.org/dc/elements/1.1/In document text (OOXML body / shared strings)
- http://iptc.org/std/Iptc4xmpExt/2008-02-29/In document text (OOXML body / shared strings)
- http://ns.adobe.com/xap/1.0/rights/In document text (OOXML body / shared strings)
- https://www.istockphoto.com/legal/license-agreement?utm_medium=organic&utm_source=google&utm_campaign=iptcurlIn document text (OOXML body / shared strings)
- https://www.istockphoto.com/photo/license-gm1178775481-?utm_medium=organic&utm_source=google&utm_campaign=iptcurlIn document text (OOXML body / shared strings)
- http://ns.adobe.com/xap/1.0/In document text (OOXML body / shared strings)
- https://www.istockphoto.com/photo/license-gm636632652-?utm_medium=organic&utm_source=google&utm_campaign=iptcurlIn document text (OOXML body / shared strings)
- https://www.istockphoto.com/photo/license-gm165501374-?utm_medium=organic&utm_source=google&utm_campaign=iptcurlIn document text (OOXML body / shared strings)
Extracted artifacts 2
Files carved from inside the sample during analysis.
| Filename | Kind | Source | Size |
|---|---|---|---|
macros.bas |
vba-macro | oletools.olevba.extract_macros (decoded VBA source from OOXML) | 302051 bytes |
SHA-256: 58e87e8636f9dd157efbeb57a5028de78043af86bee1d76c41d10c23296a77d7 |
|||
Preview scriptFirst 1,000 lines of the extracted script
Attribute VB_Name = "ThisWorkbook"
Attribute VB_Base = "0{00020819-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Attribute VB_Name = "ChonMau"
Attribute VB_Base = "0{6204380D-9523-4E44-AEF4-FD32DC6E04F0}{00B8676D-06EE-4962-A0C5-973741C9D715}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub Label1_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(0)
Unload Me
End Sub
Private Sub Label2_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(1)
Unload Me
End Sub
Private Sub Label3_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(2)
Unload Me
End Sub
Private Sub Label4_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(3)
Unload Me
End Sub
Private Sub Label5_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(4)
Unload Me
End Sub
Private Sub Label6_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(5)
Unload Me
End Sub
Private Sub Label7_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(6)
Unload Me
End Sub
Private Sub Label8_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(7)
Unload Me
End Sub
Private Sub Label9_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(8)
Unload Me
End Sub
Private Sub Label10_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(9)
Unload Me
End Sub
Private Sub Label11_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(10)
Unload Me
End Sub
Private Sub Label12_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(11)
Unload Me
End Sub
Private Sub Label13_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(12)
Unload Me
End Sub
Private Sub Label14_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(13)
Unload Me
End Sub
Private Sub Label15_Click()
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Setting_Hiligh.Mau2.BackColor = Ghu(14)
Unload Me
End Sub
Private Sub UserForm_Activate()
' Case "yellow": v = vbYellow
' Case "red": v = vbRed
' Case "blue": v = vbBlue
' Case "green": v = vbGreen
' Case "cyan": v = vbCyan
' Case "magenta": v = vbMagenta
' Case "white": v = vbWhite
' Case "black": v = vbBlack
' Case "orange": v = &H71AFFF
' Case "pink": v = &HE819E8
' Case "purple": v = &HB44343
' Case "silver": v = &HCBCBCB
' Case "violet": v = &HF5A2BF
' Case "Brown": v = &H3232AA
' Case "Beige": v = &HE819E8
Ghu = Array(&HE819E8, vbYellow, vbRed, vbBlue, vbGreen, vbCyan, vbMagenta, _
vbWhite, vbBlack, &H71AFFF, &HE819E8, &HB44343, &HCBCBCB, &HF5A2BF, &H3232AA)
Note = Array("Beige", "yellow", "red", "blue", "green", "cyan", "magenta", _
"white", "black", "orange", "pink", "purple", "silver", "violet", "Brown")
Label1.BackColor = Ghu(0): Label2.BackColor = Ghu(1)
Label3.BackColor = Ghu(2): Label4.BackColor = Ghu(3)
Label5.BackColor = Ghu(4): Label6.BackColor = Ghu(5)
Label7.BackColor = Ghu(6): Label8.BackColor = Ghu(7)
Label9.BackColor = Ghu(8): Label10.BackColor = Ghu(9)
Label11.BackColor = Ghu(10): Label12.BackColor = Ghu(11)
Label13.BackColor = Ghu(12): Label14.BackColor = Ghu(13)
Label15.BackColor = Ghu(14)
Label1.ControlTipText = Note(0): Label2.ControlTipText = Note(1)
Label3.ControlTipText = Note(2): Label4.ControlTipText = Note(3)
Label5.ControlTipText = Note(4): Label6.ControlTipText = Note(5)
Label7.ControlTipText = Note(6): Label8.ControlTipText = Note(7)
Label9.ControlTipText = Note(8): Label10.ControlTipText = Note(9)
Label11.ControlTipText = Note(10): Label12.ControlTipText = Note(11)
Label13.ControlTipText = Note(12): Label14.ControlTipText = Note(13)
Label15.ControlTipText = Note(14)
End Sub
Attribute VB_Name = "CalenChitiet"
Attribute VB_Base = "0{C644FC3A-8D63-4C9C-9C25-D899881965AD}{04CBB158-8F5F-41D1-85DF-BD5BA419CD53}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub OK_Click()
Unload Me
End Sub
Private Sub SUA_Click()
Unload Me
'ChaytinhADlich
'Sub ChaytinhADlich()
Call FormMouseDown(day(DateValue(ngayduonglich)), _
Month(DateValue(ngayduonglich)), _
Year(DateValue(ngayduonglich)))
'End Sub
CalenVannien.show
End Sub
Private Sub UserForm_Initialize()
TextBox1.Value = dongngay1 & dongdate1
TextBox2.Value = dongngay2 & dongdate2
End Sub
Attribute VB_Name = "FrmUpdate"
Attribute VB_Base = "0{BCF31677-BA56-4A17-B50F-DA0619E9A17B}{70583ADE-D2AC-4B6B-8188-384C2660F72B}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Attribute VB_Name = "CalenVannien"
Attribute VB_Base = "0{ABB87258-55E2-4ABB-952C-67226F74967C}{A11B39A0-C95A-4A62-AAAB-B1355EF918EC}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub CommandButton1_Click()
Call FormMouseDown(Month(Now()), Month(Now()), Year(Now()))
TextBox1.Value = FontConverter(str, 2, 1)
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
TextBox1.Value = FontConverter(str, 2, 1)
End Sub
Attribute VB_Name = "Sheet1"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Attribute VB_Name = "Frm_SwitchSheet"
Attribute VB_Base = "0{0E44B50F-A11F-4809-9792-50959D339BDA}{6E7FDDFA-4E1C-4C7C-9DEA-8425BEC2319F}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Attribute VB_Name = "cWindow"
Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Option Base 0
#If VBA7 Then
Private hWindow As LongPtr, hParent_ As LongPtr
Public Property Let Handle(hValue As LongPtr): hWindow = hValue: End Property
#Else
Private hWindow As Long, hParent_ As Long
Public Property Let Handle(hValue As Long): hWindow = hValue: End Property
#End If
'// Crop window
Friend Sub CropPolygon(ByRef PointsPX() As POINTAPI) ' O-----------------------------
Const ALTERNATE = 1 ', WINDING = 2 ' | A-----------------B
#If VBA7 Then ' | |//////////////////\
Dim hDrawRegion As LongPtr ' | |///////////////////\
#Else ' | |////////////////////\
Dim hDrawRegion As Long ' | |/////////////////////\
#End If ' | D----------------------C
hDrawRegion = CreatePolygonRgn(PointsPX(0), UBound(PointsPX), ALTERNATE)
Call SetWindowRgn(hWindow, hDrawRegion, True)
Call DeleteObject(hDrawRegion)
End Sub
Friend Sub CropRectangle(ByRef X1 As Long, ByRef Y1 As Long, _
ByRef X2 As Long, ByRef Y2 As Long)
#If VBA7 Then
Dim hDrawRegion As LongPtr ' O ----------------------------
#Else ' | (x1,y1)----------------
Dim hDrawRegion As Long ' | |//////////////////////|
#End If ' | |//////////////////////|
' | |//////////////////////|
hDrawRegion = CreateRectRgn(X1, Y1, X2, Y2) ' | |//////////////////////|
Call SetWindowRgn(hWindow, hDrawRegion, True) ' | ----------------(x2,y2)
Call DeleteObject(hDrawRegion) ' |
End Sub
'Make window is transparent
'NOT WORK with SetParen method
Friend Sub Transparent(Optional ByRef opacity As Byte = 255)
Const GWL_EXSTYLE = (-20), WS_EX_LAYERED = &H80000, LWA_ALPHA = &H2&
#If VBA7 Then
Dim hResult As LongPtr
hResult = GetWindowLongPtr(hWindow, GWL_EXSTYLE) Or WS_EX_LAYERED
Call SetWindowLongPtr(hWindow, GWL_EXSTYLE, hResult)
#Else
Dim hResult As Long
hResult = GetWindowLong(hWindow, GWL_EXSTYLE) Or WS_EX_LAYERED
Call SetWindowLong(hWindow, GWL_EXSTYLE, hResult)
#End If
Call SetLayeredWindowAttributes(hWindow, 0&, opacity, LWA_ALPHA)
End Sub
'Make window is alway on top
'NOT WORK with SetParen method
Friend Sub AlwaysOnTop(Optional Status As Boolean = True)
Const SWP_NOMOVE = &H2, HWND_TOPMOST = -1
Const SWP_NOSIZE = &H1, HWND_NOTOPMOST = -2
If Status Then
Call SetWindowPos(hWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
Else
Call SetWindowPos(hWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End If
End Sub
'Make window is a child of a window (parent window)
#If VBA7 Then
Friend Sub SetParent(ByVal hParent As LongPtr)
hParent_ = hParent
Call mDeclare.SetParent(hWindow, hParent)
End Sub
#Else
Friend Sub SetParent(ByVal hParent As Long)
hParent_ = hParent
Call mDeclare.SetParent(hWindow, hParent)
End Sub
#End If
'Move form when drag mouse anywhere of the background object
Friend Sub FlexMove()
Const WM_NCLBUTTONDOWN = &HA1, HTCAPTION = 2
Call Transparent(180)
Call ReleaseCapture
Call SendMessage(hWindow, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
Call Transparent
End Sub
'Make effect like Yahoo!Buzz
'Friend Sub Vibrate(Optional ByRef isSound As Boolean = True, _
' Optional ByRef bytQuake As Byte = 8, _
' Optional ByRef intSpeed As Integer = 40)
' Dim i As Byte, lngBegin&, X&, Y&, w&, h&
' Dim posItSelf As RECT, posParent As RECT
'
' Call GetWindowRect(hWindow, posItSelf)
' w = posItSelf.Right - posItSelf.Left
' h = posItSelf.Bottom - posItSelf.Top
'
' If hParent_ = 0 Then
' Y = posItSelf.Top
' Else
' Call GetWindowRect(hParent_, posParent)
' Y = posItSelf.Top - posParent.Top
' End If
'
' If isSound Then Beep
' For i = 1 To 8
' lngBegin = timeGetTime()
'
' If hParent_ = 0 Then
' X = posItSelf.Left + bytQuake * (i Mod 2)
' Else
' X = (posItSelf.Left - posParent.Left) + bytQuake * (i Mod 2)
' End If
'
' Call MoveWindow(hWindow, X, Y, w, h, True)
' Call WaitingTime(intSpeed - (timeGetTime() - lngBegin))
' Next i
'End Sub
Attribute VB_Name = "FormHenGio"
Attribute VB_Base = "0{43CA42D0-C819-4018-BCBB-E58386A4AFD6}{1A89387D-BBC7-425E-9D3E-122371137981}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Dim Landau As Boolean
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex + 1 = 5 Then
CheckBox1.Value = True
CheckBox2.Enabled = False
Else
If CheckBox2.Enabled = False Then CheckBox2.Enabled = True
End If
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim reginfo As String
Dim regname As String
Dim regdate As Date
Dim currdate As Date
Dim diffday As Long
Dim demdong As Long
If Not IsDate(TextBox1.Value) Then
MsgBox "Sai gio hen. ", vbCritical, "KTexcel Thong bao!"
Exit Sub
End If
If TextBox2.Value = "" Then
MsgBox "Khong co noi dung. ", vbCritical, "KTexcel Thong bao!"
Exit Sub
End If
If TimeValue(TextBox1.Value) <= TimeValue(Now()) And _
DateValue(TextBox3.Value) <= DateValue(Now()) Then
MsgBox "Da qua gio hen roi khong the hen duoc. ", vbCritical, "KTexcel Thong bao!"
Exit Sub
End If
If Len(Dir(Duongdandulieu, vbDirectory)) = 0 Or Duongdandulieu = "" Then Me.Hide: Call ChuyenDLvaolich
Dim Cóhayko As Boolean, Cóhaykos As Boolean
Cóhayko = False
Cóhaykos = False
'Kiem tra co trung time ko
LayData Duongdandulieu, "Alarm", "A:G"
'If loai = 1 Then 'Lay du lieu de RUN
Do Until rsData.EOF
If rsData!Loai > 1 Or Left(rsData!Xong & rsData!Loai, 1) <> "R" Then
If Format(rsData!Ngay_ho_hen, "dd/mm/yy hh:mm:ss") = Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & ":00" Then
Cóhayko = True ': MsgBox "cocococo"
ElseIf Format(rsData!Ngay_ho_hen, "dd/mm/yy hh:mm:ss") = Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & ":02" Then
Cóhaykos = True ': MsgBox "cocococo"
Exit Do
End If
End If
rsData.MoveNext
Loop
'End If
rsData.Close
Set rsData = Nothing
rsCon.Close
Set rsCon = Nothing
'Them vao KTEAlarm
ThemData Duongdandulieu, "Alarm", "A:G", _
Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00")), _
" " & TextBox4.text, TextBox2.text, "", ComboBox1.ListIndex + 1, "2", _
IIf(CheckBox1.Value = True, 1, 2)
'Them tren sheet1
'Bat dau hen gio
'If CheckBox1.Value = True Then Ktra_RUN_1 CVDate(Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & _
IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00"))) Else _
Ktra_RUN_1 CVDate(AL2DL(Format(TextBox3.text, "dd/mm/yy")) & " 00:01:00")
'THEM VAO SHEET1 ko Upadate
'If ThisWorkbook.Sheets(1).Range("E1000").End(xlUp).Address = "$E$1" And _
' ThisWorkbook.Sheets(1).Range("E1000").End(xlUp).Value = "" Then
'demdong = 0
'Else
'demdong = ThisWorkbook.Sheets(1).Range("E1000").End(xlUp).Row + 0
'End If
'ThisWorkbook.Sheets(1).Range("E1").Offset(demdong, 0).Value = Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & _
IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00")) 'Ngay goc
'ThisWorkbook.Sheets(1).Range("E1").Offset(demdong, 1).Value = Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & _
IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00")) 'Ngay hen gio
'ThisWorkbook.Sheets(1).Range("E1").Offset(demdong, 2).Value = TextBox4.text 'Tieu de
'ThisWorkbook.Sheets(1).Range("E1").Offset(demdong, 3).Value = TextBox2.text 'Noi dung
'Application.StatusBar = FontConverter(" Ñaõ theâm heïn giôø: ", 2, 1) & Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & _
IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00"))
'If CheckBox1.Value = True Then Reminder3 CVDate(Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & _
IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00"))), TextBox4.text, TextBox2.text, "gio" Else _
Reminder3 CVDate(AL2DL(Format(TextBox3.text, "dd/mm/yy")) & " 00:01:00"), TextBox4.text, TextBox2.text, "gio"
' Application.OnTime CVDate(Format(TextBox3.text, "dd/mm/yy") & " " & TextBox1.text & _
IIf(Cóhaykos = True, ":04", IIf(Cóhayko = True, ":02", ":00"))), ThisWorkbook.Name & "!Reminder5"
Application.OnTime Now + TimeValue("00:00:00"), ThisWorkbook.Name & "!Ktra_RUN_ALL"
'Application.OnTime Now + TimeValue("00:00:02"), ThisWorkbook.Name & "!Thoat_StatusBar"
Unload Me
End Sub
Private Sub CheckBox1_Click()
If CheckBox1.Value = True And CheckBox2.Enabled = True Then
CheckBox2.Value = False
Else
If CheckBox2.Enabled = True Then
CheckBox2.Value = True
Else
CheckBox1.Value = True
End If
End If
End Sub
Private Sub CheckBox2_Click()
If CheckBox2.Value = True Then CheckBox1.Value = False Else CheckBox1.Value = True
If CheckBox2.Value = True Then
If Not IsDate(TextBox3) Then Exit Sub
With GetAllLunarInfo(day(TextBox3), Month(TextBox3), Year(TextBox3), 7)
TextBox3.text = Format(.fdLunarDate.fdDay, "0#") & "/" _
& Format(.fdLunarDate.fdMonth, "0#") & "/" _
& .fdLunarDate.fdYear
End With
TextBox3.ForeColor = &HFF&
Else 'Chuyen qua lich DUONG
TextBox3.ForeColor = &HFFFF&
With Lunar2Sonar(day(TextBox3), Month(TextBox3), Year(TextBox3), 1, 7)
TextBox3.text = Format(.fdDay, "0#") & "/" & Format(.fdMonth, "0#") & "/" & .fdYear
End With
End If
'Landau = False
End Sub
Private Sub TextBox1_Change()
On Error Resume Next
If Len(TextBox1.Value) = 5 Then
If Not IsNumeric(Left(TextBox1.Value, 2)) Or _
Not IsNumeric(Right(TextBox1.Value, 2)) Or _
Not IsNumeric(Left(TextBox1.Value, 1)) Or _
Not IsNumeric(Right(TextBox1.Value, 1)) Then _
TextBox1.Value = Format(Time + TimeValue("00:01"), "hh:mm")
ElseIf Len(TextBox1.Value) > 5 Then
TextBox1.Value = Format(Time + TimeValue("00:01"), "hh:mm")
End If
If Val(Left(TextBox1.Value, 2)) > 24 Then
TextBox1.Value = Format(Time + TimeValue("00:01"), "hh:mm")
TextBox1.SelLength = 1
TextBox1.SelStart = 2
End If
If Val(Right(TextBox1.Value, 2)) > 60 And _
Len(TextBox1.Value) > 3 Then
TextBox1.Value = Format(Time + TimeValue("00:01"), "hh:mm")
TextBox1.SelLength = 1
TextBox1.SelStart = 5
End If
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
If Len(TextBox1.Value) = 4 And _
Application.WorksheetFunction.Find(":", _
TextBox1.Value) = 0 Then
If TimeValue(IsDate(Left(TextBox1.Value, 2) & _
":" & Right(TextBox1.Value, 2))) Then _
TextBox1.Value = Left(TextBox1.Value, 2) & _
":" & Right(TextBox1.Value, 2)
End If
If Not IsDate(TextBox1.Value) Then
MsgBox "Sai gio hen.", vbCritical, "KTexcel Thong bao!"
Exit Sub
End If
End Sub
Private Sub TextBox2_Enter()
If Not IsDate(TextBox1.Value) Then
TextBox1.SetFocus
End If
End Sub
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(TextBox3.Value) = 4 Then
If IsDate(DateSerial(Year(Now()), _
Right(TextBox3.Value, 2), Left(TextBox3.Value, 2))) Then
TextBox3.Value = Left(TextBox3.Value, 2) & "/" & _
Right(TextBox3.Value, 2) & "/" & Year(Now())
TextBox3.Value = Format(TextBox3.Value, "dd/mm/yyyy")
If Not IsDate(TextBox3.Value) Then GoTo boquas
Else
boquas:
TextBox3.Value = Format(Now(), "dd/mm/yyyy")
End If
ElseIf Len(TextBox3.Value) = 8 Then
TextBox3.Value = Left(TextBox3.Value, 2) & "/" & _
Mid(TextBox3.Value, 3, 2) & "/" & Right(TextBox3.Value, 4)
TextBox3.Value = Format(TextBox3.Value, "dd/mm/yyyy")
If Not IsDate(TextBox3.Value) Then GoTo boquas
ElseIf Not IsDate(TextBox3.Value) Then
TextBox3.Value = Format(Now(), "dd/mm/yyyy")
End If
End Sub
Private Sub UserForm_Initialize()
If AppLanguage Then
Me.Label5.Caption = "Enter the 24-hour pattern. For example:" & Chr(10) & _
" enter 15:10 is 3:10 PM, 10:00 is 10:00 AM"
Me.Label6.Caption = "Day/Month/Year"
Me.Label7.Caption = "Hour:Minute"
Me.Label2.Caption = "Title"
Me.Label4.Caption = "Methol repeat"
Me.Label3.Caption = "Content"
Me.CommandButton1.Caption = "Cancel"
Else
Me.Label5.Caption = FontConverter("Nhaäp kieåu 24 giôø. Ví duï:" & Chr(10) & _
" nhaäp 15:10 laø 3:10PM, 10:00 laø 10:00AM", 2, 1)
Me.Label6.Caption = FontConverter("Ngaøy/Thaùng/Naêm", 2, 1)
Me.Label7.Caption = FontConverter("Giôø:Phuùt", 2, 1)
Me.Label2.Caption = FontConverter("Tieâu ñeà", 2, 1)
Me.Label4.Caption = FontConverter("Caùch laëp laïi", 2, 1)
Me.Label3.Caption = FontConverter("Noäi dung", 2, 1)
Me.CommandButton1.Caption = FontConverter("Huûy boû", 2, 1)
End If
Landau = True
ComboBox1.AddItem FontConverter("Duy nhaát 1 laàn", 2, 1)
ComboBox1.AddItem FontConverter("Laëp laïi sau 5 phuùt", 2, 1)
ComboBox1.AddItem FontConverter("Laëp laïi sau 30 phuùt", 2, 1)
ComboBox1.AddItem FontConverter("Laëp laïi sau 1 giôø", 2, 1)
ComboBox1.AddItem FontConverter("Laëp laïi theo ngaøy", 2, 1)
ComboBox1.AddItem FontConverter("Laëp laïi theo thaùng", 2, 1)
ComboBox1.AddItem FontConverter("Laëp laïi haèng naêm", 2, 1)
ComboBox1.ListIndex = 0
Label2.Enabled = True
If (CalendarKTE Is Nothing) Then
'MsgBox "ko co"
ngays = ""
ElseIf Not CalendarKTE.visible Then
'MsgBox "ko co"
ngays = ""
End If
TextBox3.Value = IIf(ngays <> "" And thangs <> "" And nams <> "", ngays & "/" & thangs & "/" & nams, Format(Now(), "dd/mm/yyyy"))
TextBox2.Enabled = True
TextBox2.BackColor = &HFFFFFF
TextBox1.Value = Format(Time + TimeValue("00:01"), "hh:mm")
If Duongdandulieu = "" Then Exit Sub
End Sub
Private Sub UserForm_Terminate()
ThisWorkbook.Sheets(1).Range("A:D").Clear
End Sub
Attribute VB_Name = "clsLabel"
Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Public WithEvents theLabel As MSForms.Label
Attribute theLabel.VB_VarHelpID = -1
Private WithEvents mButton1 As Office.CommandBarButton ' Manages the popup menu
Attribute mButton1.VB_VarHelpID = -1
Private WithEvents mButton2 As Office.CommandBarButton ' As above
Attribute mButton2.VB_VarHelpID = -1
Private WithEvents mButton3 As Office.CommandBarButton
Attribute mButton3.VB_VarHelpID = -1
Private Sub theLabel_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'CheckRghtClk Button, theLabel
If Button = 2 Then
ngays = theLabel.Parent.Controls("day" & Right(theLabel.Name, 2)).Caption 'theLabel.Caption
thangs = Application.Match(theLabel.Parent.monthTitle, monthName, False) 'theLabel.Parent.sMonth
nams = theLabel.Parent.yearTitle
CalendarKTE.Frame1.visible = False
ShowPopupMenu ""
ElseIf Button = 1 Then
On Error Resume Next
Application.CommandBars.Item("PopupCalendar").Delete
End If
End Sub
Private Sub ShowPopupMenu(pLinkType As String)
On Error Resume Next
Dim wPopupMenu As Office.CommandBar
Set wPopupMenu = Application.CommandBars.Item("PopupCalendar")
If Not wPopupMenu Is Nothing Then
wPopupMenu.Delete
Set wPopupMenu = Nothing
End If
Set wPopupMenu = Application.CommandBars.Add(Name:="PopupCalendar", Position:=msoBarPopup, Temporary:=True)
wPopupMenu.Enabled = True
'Menu ALL
Set mButton1 = Nothing
Set mButton1 = wPopupMenu.Controls.Add(Type:=msoControlButton, id:=1, Parameter:="TM1", Temporary:=True)
With mButton1
.Caption = "Chuyen doi lich Duong sang Am"
.Enabled = True
.FaceId = 125 ' Show check mark 990
'.State = msoButtonDown ' Show pressed
.Style = msoButtonIconAndCaption
.visible = True
.OnAction = "ChuyendoiDuong2Am"
End With
Set mButton2 = Nothing
Set mButton2 = wPopupMenu.Controls.Add(Type:=msoControlButton, id:=1, Parameter:="TM2", Temporary:=True)
With mButton2
.Caption = "Chuyen doi lich Am sang Duong"
.Enabled = True
.FaceId = 304
'.State = msoButtonDown
.Style = msoButtonIconAndCaption
.visible = True
.OnAction = "ChuyendoiAm2Duong"
End With
Set mButton3 = Nothing
Set mButton3 = wPopupMenu.Controls.Add(Type:=msoControlButton, id:=1, Parameter:="TM3", Temporary:=True)
With mButton3
.Caption = "Hen gio"
.Enabled = True
.FaceId = 126
'.State = msoButtonDown
.Style = msoButtonIconAndCaption
.visible = True
.OnAction = "HengioForm"
End With
wPopupMenu.ShowPopup
If Not wPopupMenu Is Nothing Then wPopupMenu.Delete
Set mButton1 = Nothing
Set mButton2 = Nothing
Set mButton3 = Nothing
Set wPopupMenu = Nothing
End Sub
Private Sub theLabel_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim Ftvs As String '¦UºØ¸`¤é¦r¦ê
Dim theLeft As Single, theTop As Single '°_©l®y¼Ð¥Î
If IsNumeric(Right(theLabel.Caption, 1)) Then
If theLabel.Parent.Controls("LD" & Right(theLabel.Name, 2)).ForeColor = vbRed Or _
theLabel.Parent.Controls("day" & Right(theLabel.Name, 2)).ForeColor = vbRed Or _
theLabel.Parent.Controls("LD" & Right(theLabel.Name, 2)).ForeColor = vbGreen Or _
theLabel.Parent.Controls("day" & Right(theLabel.Name, 2)).ForeColor = vbGreen Then
With theLabel.Parent
If Len(Right(.Name, 2)) > 1 Then
.sDate.Caption = theLabel.Parent.Controls("A" & Right(theLabel.Name, 2)).text
.Week.Caption = theLabel.Parent.Controls("B" & Right(theLabel.Name, 2)).text
.lDate.Caption = theLabel.Parent.Controls("C" & Right(theLabel.Name, 2)).text
Ftvs = theLabel.Parent.Controls("D" & Right(theLabel.Name, 2)).text
With .Ftv1
.Caption = Ftvs
.AutoSize = False
.Width = 101
.AutoSize = True
.Width = 100
End With
With .Frame1
.visible = True
theTop = Y + theLabel.Top + 10
theLeft = X - .Width / 2 + theLabel.Left
If theLeft < 0 Then theLeft = 2
If theLeft > 160 Then theLeft = 160
.Left = theLeft
If Ftvs <> "" Then .Height = .Controls("Ftv1").Top + 2 + .Controls("Ftv1").Height + 2
If theTop + .Height + 20 > .Parent.Height Then theTop = theTop - .Height - 20
.Top = theTop
.visible = True
End With
End If
End With
Else
theLabel.Parent.Frame1.visible = False
End If
Else
theLabel.Parent.Frame1.visible = False
End If
End Sub
Attribute VB_Name = "Setting_Hiligh"
Attribute VB_Base = "0{A8ECF217-73A6-416F-AB61-4772C7596202}{378538E2-ABB5-469F-A291-1A80354FEAAA}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private ii As Long
Private Sub CheckBox2_Click()
If CheckBox2 = True Then CheckBox3.Value = False: Net.Enabled = False
If CheckBox2 = False Then CheckBox3.Value = True: Net.Enabled = True
End Sub
Private Sub CheckBox3_Click()
If CheckBox3 = True Then
Net.Enabled = True
Mau.visible = False
Mau2.visible = True
CheckBox2.Value = False
Mau2.Top = Mau.Top
Else
Mau2.visible = False
Mau.visible = True
CheckBox2.Value = True
Net.Enabled = False
End If
End Sub
Private Sub cmdMD_Click()
On Error Resume Next
Mau2.BackColor = vbCyan
Net.Value = 40
SaveSetting "KTExcel", "ThietLap", "Net", 40
CheckBox3.Value = True
End Sub
Private Sub cmdTL_Click()
'If CheckBox2.Value = False And CheckBox3.Value = False Then Exit Sub
On Error Resume Next
'SaveSetting "KTExcel", "ThietLap", "Kieu", CheckBox2.Value
If CheckBox3.Value Then
SaveSetting "KTExcel", "ThietLap", "Kieu", "Tienhk"
Me.Hide
SaveSetting "KTExcel", "ThietLap", "Mau2", Mau2.BackColor
SaveSetting "KTExcel", "ThietLap", "Net", Net.Value
ElseIf CheckBox2.Value Then
SaveSetting "KTExcel", "ThietLap", "Kieu", CheckBox2.Value
SaveSetting "KTExcel", "ThietLap", "Mau", Mau.BackColor
End If
HighLight_OK
Unload Me
End Sub
Private Sub Mau_Click()
On Error Resume Next
Application.Dialogs(xlDialogEditColor).show (10)
Mau.BackColor = ActiveWorkbook.Colors(10)
ThaydoimauHL = True
End Sub
Private Sub Mau2_Click()
ChonMau.show
End Sub
Private Sub Net_Change()
FaCe.Caption = Net.Value
End Sub
Private Sub UserForm_Initialize()
ThaydoimauHL = False
On Error Resume Next
'Net.AddItem 3
Mau.BackColor = GetSetting("KTExcel", "ThietLap", "Mau", vbCyan)
Mau2.BackColor = GetSetting("KTExcel", "ThietLap", "Mau2", vbCyan)
Net.Value = GetSetting("KTExcel", "ThietLap", "Net", 40)
FaCe.Caption = Net.Value
If GetSetting("KTExcel", "ThietLap", "Kieu", "False") = "Tienhk" Then
CheckBox3.Value = True
Else
CheckBox2.Value = True
End If
cmdTL.SetFocus
End Sub
Attribute VB_Name = "CalendarKTE"
Attribute VB_Base = "0{CDECC619-C01D-464E-ABD3-7A91AE1EA74D}{B02443B0-E5FF-4877-A413-0CC2BC20A84F}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Dim iToday As Integer
Dim oLOLOoiIliIOOdolOlOlidIOi As Integer
'THEM CAI ALICH
Dim myCls As clsLabel
Dim myCls2 As clsLabel
Dim myCls3 As clsLabel
Dim myColl As Collection
Dim myColl2 As Collection
Dim myColl3 As Collection
'HET AL lan 1
Private Sub Frame1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
With Me.Frame1
.visible = False
'.Height = Me.clDate.Top + Me.clDate.Height + 2
End With
End Sub
Private Sub Label2_Click()
List_Hen.show
End Sub
Private Sub Label3_Click()
HengioForm
End Sub
Private Sub sDate_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
With Me.Frame1
.visible = False
'.Height = Me.clDate.Top + Me.clDate.Height + 2
End With
End Sub
Private Sub Todaynow_Click()
LiLlLLIdiiliOoiioLdoolooi
End Sub
Private Sub Label4_Click()
LOIloOILiLoLodOLLOLodoiLL
Unload Me
End Sub
Private Sub monthTitle_Click()
iliiiLiioLIdodiliLOLIodIO = months
oLOLOoiIliIOOdolOlOlidIOi = 0
idILidolOIoddOOIodIlIlOoI
End Sub
Private Sub yearTitle_Click()
iliiiLiioLIdodiliLOLIodIO = years
oLOLOoiIliIOOdolOlOlidIOi = 0
dLIiilLLolOIioOlIILLioOII
End Sub
Public Sub nextMonthButton_Click()
If pickerMode = 0 Then
months = months + 1
If months > 12 Then
months = 1
years = years + 1
End If
IillilIidlOLlolooOIlLOLOl
ElseIf pickerMode = 2 Then
IOIOdloiOOOooOOIllldlOioO = IOIOdloiOOOooOOIllldlOioO + 3
IoiLiOIiiLiIILlLioolidllI
End If
End Sub
Public Sub prevMonthButton_Click()
If pickerMode = 0 Then
months = months - 1
If months < 1 Then
months = 12
years = years - 1
…
|
|||
vbaProject_00.bin |
vba-project | OOXML VBA project: xl/vbaProject.bin | 910336 bytes |
SHA-256: d2c19537a4385729e37c09236a2a2323b44182798b3b73c4d443362a02322363 |
|||
Open this report in the interactive analyzer, or submit your own file for analysis.