I donβt think there is a cleaner way to do this so that you can simply wrap it with a function. Another way to do this would be with replace , but it is not any cleaner.
Function Insert(source As String, str As String, i As Integer) As String Insert = Replace(source, tmp, str & Right(source, Len(source)-i)) End Function
or just change what you have
Function Insert(source As String, str As String, i As Integer) As String Insert = Mid(source, 1, i) & str & Mid(source, i+1, Len(source)-i) End Function
source share