October 9, 1999

ShortPathName – Convert a long file name to 8.3 format

Private Declare Function GetShortPathName Lib “kernel32” Alias _ “GetShortPathNameA” (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As LongConst MAX_PATH = 260′ Convert a long file/path name to a short 8.3 name’ the path must exist, but the file doesn’t have to’ Return a null

The number of days in a month

You need just one-line function to evaluate the number of days in a month (while taking leap years into account, of course). The trick is to use the DateDiff and DateSerial functions to calculate the difference between the first day of the current month and the first day of the

Evaluate the number of days remaining in the current year

The DatePart() function can return the number of days from the beginning of the current year, but there is no VB built-in function that returns the number of days left to the end of the year. You can work around this with the DateDiff function: ‘ aDate contains a valid

LongPathName – Convert a 8.3 file name to long format

Private Declare Function GetLongPathName Lib “kernel32” Alias _ “GetLongPathNameA” (ByVal lpszShortPath As String, _ ByVal lpszLongPath As String, ByVal cchBuffer As Long) As LongConst MAX_PATH = 260′ Convert a short file/path name to a long name’ the file or path must exist’ returns a null string in case of error”

TimeToString – Convert time to a descriptive string

‘ convert a date value into a string in the format’ YY years, MM months, DD days, HH hours, MM minutes, SS.HH seconds)’ you can also opt for time short format (HH h, MM m, SS s)Function TimeToString(ByVal aDate As Date, Optional ShortTimeFormat As Boolean, _ Optional showHundredths As Boolean)