Menjadikan huruf awal menjadi huruf besar

Public Function FirstUCaseWord(ByVal MyString As String) As String Dim PosSpc As Integer Mid(MyString, 1, 1) = UCase(Mid(MyString, 1, 1)) PosSpc = InStr(MyString, ” “) While PosSpc <> 0 Mid(MyString, PosSpc + 1, 1) = UCase(Mid(MyString, PosSpc + 1, 1)) PosSpc = InStr(PosSpc + 1, MyString, ” “) Wend FirstUCaseWord = MyString End Function

Nilai tanggal awal dari bulan

Public Function FirstOfMonth(ByVal xDate As Date) As Date FirstOfMonth = DateSerial(Year(xDate), Month(xDate), 1) End Function

Nilai tanggal akhir dari satu bulan

Public Function EndOfMonth(ByVal xDate As Date) As Date EndOfMonth = DateSerial(Year(xDate), Month(xDate) + 1, 0) End Function

Nilai tanggal akhir dari satu minggu

Public Function EndOfWeek(ByVal xDate As Date) As Date EndOfWeek = xDate – Weekday(xDate) + 7 End Function

Mendapatkan Nama user pada Operasi Windows

Mendapatkan Nama user pada Operasi Windows ‘— Letakkan di module Public Declare Function GetUserNameA Lib “advapi32.dll” _ (ByVal lpBuffer As String, nSize As Long) As Long ‘— Akhir Letakkan di module Public Function GetUserName() As String Dim UserName As String * 255 Call GetUserNameA(UserName, 255) GetUserName = Left$(UserName, InStr(UserName, Chr$(0)) – 1) End Function Private [...]

Mendapatkan Nilai dari Resolusi Windows

Mendapatkan Nilai dari Resolusi Windows Public Function GetWinScrResolution() As String Dim intWidth As Integer Dim intHeight As Integer intWidth = Screen.Width \ Screen.TwipsPerPixelX intHeight = Screen.Height \ Screen.TwipsPerPixelY GetWinScrResolution = Str$(intWidth) + ” x” + Str$(intHeight) End Function Private Sub Form_Load() MsgBox GetWinScrResolution End Sub

Mendapatkan Posisi direktory system Windows

Fungsi untuk Mendapatkan Posisi direktory system Windows ‘— Letakkan di module Declare Function GetSystemDirectory Lib “kernel32″ Alias “GetSystemDirectoryA” _ (ByVal lpBuffer As String, ByVal nSize As Long) As Long ‘— Akhir Letakkan di module Public Function GetSysDir() As String Dim boolRetVal As Boolean, lpBuffer As String, nSize As Long lpBuffer = Space(255): nSize = 254 [...]

Mendapatkan Nama Komputer

Fungsi Mendapatkan Nama Komputer ‘— Letakkan di module Public Declare Function GetComputerName Lib “kernel32″ Alias “GetComputerNameA” (ByVal lpBuffer As String, nSize As Long) As Long ‘— Akhir Letakkan di module Public Function GetMyComputerName() As String Dim Bufstr$, sComputerName$ Bufstr = Space$(50) If GetComputerName(Bufstr, 50) > 0 Then sComputerName = Bufstr sComputerName = RTrim(sComputerName) sComputerName = [...]

Menghapus File

Public Function FileDelete(ByVal strFile As String) If CBool(Len(Dir$(strFile))) Then Call Kill(strFile) End Function

Menyembunyikan, menampilkan, minimize MDI child forms.

Menyembunyikan, menampilkan, minimize MDI child forms. Declare Function ShowWindow% Lib “User” (ByVal hWnd%, ByVal nCmdShow%) Global Const SW_HIDE = 0 Global Const SW_SHOWNORMAL = 1 Global Const SW_SHOWMINIMIZED = 2 Global Const SW_SHOWMAXIMIZED = 3 Global Const SW_SHOWNOACTIVE = 4 Global Const SW_SHOW = 5 Global Const SW_MINIMIZE = 6 Global Const SW_SHOWMINNOACTIVE = 7 [...]

Ikuti

Get every new post delivered to your Inbox.