My earlier suggestion as a function:Code:Option Explicit Public Function Alternate(Expression As String, Optional ByVal Length As Long = 2) As String Select Case Length Case Is < 1 Case 1 If Len(Expression) Then Alternate = String$(Len(Expression), Left$(Expression, 1)) Case Else Alternate = Expression If Length < Len(Expression) Then Mid$(Alternate, 1 + Length) = Alternate End Select End Function Private Sub Form_Load() Debug.Print Alternate("1234567890", 3) End Sub




Reply With Quote