Just wondering, is there any equivalent in VBA to VB .NET\'s PadLeft and PadRight methods?
As of right now, whenever I want to take a string and make it a fixed leng
You could use these. Put them in a public module
'NB Fails if input string is longer than the total length
Function PadLeft(text As Variant, totalLength As Integer, padCharacter As String) As String
PadLeft = String(totalLength - Len(CStr(text)), padCharacter) & CStr(text)
End Function
Function PadRight(text As Variant, totalLength As Integer, padCharacter As String) As String
PadRight = CStr(text) & String(totalLength - Len(CStr(text)), padCharacter)
End Function