This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function TH2W(strInput As String) As String | |
'Convert Thai numeral to Western numeral | |
Dim numberArray | |
numberArray = Array(ChrW(3664), "0", _ | |
ChrW(3665), "1", _ | |
ChrW(3666), "2", _ | |
ChrW(3667), "3", _ | |
ChrW(3668), "4", _ | |
ChrW(3669), "5", _ | |
ChrW(3670), "6", _ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub W2THConvert() | |
'Numeral converter 1.0 | |
'copyright 2022 Pongsathorn Sraouthai | |
'for convert western numeral to Thai numeral or Thai numeral to western numeral. | |
Dim r As Range | |
Dim c As Range | |
Dim cdata | |
Dim copt | |
Dim cdp | |
Dim LangID, LangUI(6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Public Function Crc6(b() As Byte) As Long | |
Dim i As Long, crc As Long: Static crcTab(0 To 255) As Long | |
If crcTab(1) = 0 Then CreateLookupTable crcTab, 6, True, &H6B& | |
crc = 63 | |
For i = LBound(b) To UBound(b) | |
crc = crcTab((crc Xor b(i)) And &HFF&) Xor (crc \ 256) | |
Next i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function PromptPayQR(PromptPayID As String, Optional BahtValue As Double = 0#, Optional OneTime As Boolean = False) | |
'PromptPay QR code Generator By Pongsathorn Sraouthai BE 2566 (V 2.0) | |
'This will convert text to encode to QR code for use to generate QR 2D Barcode | |
'Using PROMPTPAYQR(PromptPayID,BahtValue,OneTime) | |
'PromptPayID = PromptPay ID (Mobile Phone number (10 digit) or Thai ID number (13 digit) or E-Wallet Number (15 digit)) | |
'BahtValue = amount of money | |
'Onetime = True or False (Default is False) | |
'More information https://www.blognone.com/node/95133 | |
Dim CRC16Calc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ETCorrection() | |
'For correction miss spelling from English to Thai. | |
Dim i | |
Dim EngChar | |
Dim ThaChar | |
Dim EngArray As Variant | |
Dim ThaArray As Variant | |
EngChar = "1 2 3 4 5 6 7 8 9 0 - = ! @ # $ % ^ & * ( ) _ + q w e r t y u i o p [ ] \ Q W E R T Y U I O P { } | a s d f g h j k l ; ' A S D F G H J K L : "" z x c v b n m , . / Z X C V B N M < > ?" | |
EngArray = Split(EngChar, " ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ETConv(iText As String) | |
'For convert miss spelling in keyboard language from English to Thai (Spelling Thai in English Keyboard) | |
'English Keyboard | |
Dim e1 '1st row | |
'Thai Kedmanee Keyboard | |
Dim t1 '1st row | |
Dim eArray As Variant | |
Dim tArray As Variant | |
Dim i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ETCorrection() | |
'For convert miss spelling in keyboard language from English to Thai (Spelling Thai in English Keyboard) | |
'by Pongsathorn Sraouthai | |
Dim i, s | |
Dim EngChar | |
Dim ThaChar | |
Dim EngArray As Variant | |
Dim ThaArray As Variant | |
Dim msg As Outlook.MailItem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Function XLMod(a, b) | |
'สำหรับใช้แทน mod ของ vba เนื่องจาก mod operator ของ vba ไม่รองรับเลขทศนิยม | |
XLMod = a - b * Int(a / b) | |
End Function | |
Function AthikaMas(iYear As Integer) As Boolean | |
'สูตรสำหรับคำนวณปีอธิกมาส | |
'Return True if the specified year is AthikaMas. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Function XLMod(a, b) | |
' This attempts to mimic the Excel MOD function | |
XLMod = a - b * Int(a / b) | |
End Function | |
Function AthikaMas(iYear As Integer) As Boolean | |
'AthikaMas calculation | |
'Return True if the specified year is AthikaMas. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function LNLDate(iDate As Date, Optional DispNumber As Integer = 0, Optional Zodiac As Integer = 0, Optional Era As Integer = 0, Optional DhammaDay As Boolean = False, Optional NumberOnly As Boolean = False) | |
'LNLDate = Lanna Lunar Date สำหรับแสดงผลวันที่แบบจันทรคติล้านนา | |
'แปลงวันที่แบบสุริยคติให้เป็นจันทรคติ | |
'Copyright 2022 and later by Pongsathorn Sraouthai | |
'Version 2.0 Optimized for faster calculation | |
'Inspired by Loy's calculation | |
'ตัวแปร | |
'iDate = วันที่ ที่ใช้อ้างอิง | |
'DispNumber = แสดงผลตัวเลข 0 เลขอารบิก 1 เลขไทย 2 เลขโหราล้านนา |
OlderNewer