Function Pad_Data (ByVal SentData As String, AmtSPCS As Integer, Justify As String) ' This Function returns the data sent the specified length. ' Pass this function Data to pad or truncate, the max length, ' L for left justify, R for right justify or C for center justify ' EXAMPLE : Pad_Data("JON",10,"R") = ' JON' (the apostrophes are not returned) ' >> Use a MonoSpace Font (Courier or Courier New) << SentData = Trim(SentData) Pad_Data = SentData If SentData = "" Then Pad_Data = Space$(AmtSPCS) Exit Function End If If Len(SentData) > AmtSPCS Then Pad_Data = Left$(SentData, AmtSPCS) Exit Function End If Select Case UCase$(Justify) Case "L" ' Left Justify SPCS$ = Space$(AmtSPCS) Pad_Data = SentData + Left$(SPCS$, (AmtSPCS - Len(SentData))) Case "R" ' Right Justify SPCS$ = Space$(AmtSPCS) Pad_Data = Left$(SPCS$, (AmtSPCS - Len(SentData))) + SentData Case "C" ' Center Justify HlfSpace = Space$((AmtSPCS - Len(SentData)) \ 2) Pad_Data = HlfSpace & SentData & HlfSpace Case Else MsgBox "Justification can ONLY be 'L', 'R' or 'C'", 48, "PAD DATA" End Select End Function