This piece of code trims long file names to fit into forms captions, text boxes, and other limited spaces. The code allows you to specify the number of characters a file name must be before it performs the trimming. For example, if the label can hold 50 characters, then you would type LongDirFix(nFile,50). It’s as simple as that. Here’s the code:
Function LongDirFix(Incomming As _ String, Max As Integer) As StringDim i As Integer, LblLen As Integer, StringLen As IntegerDim TempString As StringTempString = IncommingLblLen = MaxIf Len(TempString)