June 23, 2003

GetDBDate – Formatting a date as a DateSerial for Access

‘ Format a date as a DateSerial for Access’ Example: Debug.Print GetDBDate(date)Public Function GetDBDate(sDate As String) As String On Error GoTo ERROR_GetDBDate Dim sTmp As String If IsDate(sDate) = False Then sTmp = sDate Else sTmp = “DateSerial(” & Year(sDate) & “, ” & Month(sDate) & “, ” & Day

GetStringBetweenTags – Returns a string between 2 delimiters

‘ Returns a string between 2 delimiters’ Parameters:’ sSearchIn: String to search’ sFrom: First keyword’ sUntil: Second keywords’ nPosAfter: Gets the position after” Example:’ Debug.Print GetStringBetweenTags(“This is a sample of title”,’ “”, “”)Public Function GetStringBetweenTags(ByVal sSearchIn As String, _ ByVal sFrom As String, ByVal sUntil As String, Optional nPosAfter As

GetDefaultDriverName – Retrieving the default printer Driver name

Private Declare Function GetProfileString Lib “kernel32” Alias _ “GetProfileStringA” (ByVal lpAppName As String, ByVal lpKeyName As String, _ ByVal lpDefault As String, ByVal lpReturnedString As String, _ ByVal nSize As Long) As LongPrivate Declare Function PrinterProperties Lib “winspool.drv” (ByVal hwnd As _ Long, ByVal hPrinter As Long) As LongPrivate Declare

PermuteString – Generating all possible combinations out of a string

‘ Generates all combination possibilities out of a stringPublic Function PermuteString(ByVal Ztring As String, Optional Base As String = _ “”) As String Dim TmpStrArray() As String, I As Long ‘ If there’s only 1 element then If InStr(1, Ztring, ” “, vbTextCompare) = 0 Then PermuteString = Base &

Changing the icon of a drive

By editing the Registry it is possible to change the icon that Windows Explorer uses for a drive. For example, if you want to change Drive E’s icon, create the following registry key: HEKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrent VersionExplorerDriveIconsEDefaultIcon When you create the above key, a string value named “Default” with value not set