silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys,
just need to get this function running but struggling at present.
with this code above found here
the problem I have is that I just like to replace the characters only till the last dot.
Therefor I did use the varible intPos as above but how to I need to adapt it to my Replace function.
for example.... strText="4141_01-12-2019.xlsx" so I like to have the outcome "4141_01_12_2019.xlsx"
So the last Dot not changed.
Thanks for help!
Albert
just need to get this function running but struggling at present.
VBA Code:
Function ChangeCharacters(ByVal strText As String) As String
Dim intPos As Integer
intPos = InStrRev(strText, ".")
Const c_Sonder As String = " -.,_:;#+ß'*?=)(/&%$§!~\}][{"
Dim i As Integer
For i = 1 To Len(c_Sonder)
strText = Replace(strText, Mid(c_Sonder, i, 1), "_")
Next i
ChangeCharacters = strText
End Function
Therefor I did use the varible intPos as above but how to I need to adapt it to my Replace function.
for example.... strText="4141_01-12-2019.xlsx" so I like to have the outcome "4141_01_12_2019.xlsx"
So the last Dot not changed.
Thanks for help!
Albert