Hi Everyone . I have a string "Mel\EGGER\mdf.p2m" and i'd like to change in to "\EGGER\mdf.png" Does any of you know to tell me to do it? Thank you for your time Kostas
Printable View
Hi Everyone . I have a string "Mel\EGGER\mdf.p2m" and i'd like to change in to "\EGGER\mdf.png" Does any of you know to tell me to do it? Thank you for your time Kostas
Seems awfully specific - fastest would be to just re-type it
Here's a User Defined Function that you can put in a worksheet or use in a VBA macro
Code:Option Explicit
Sub test()
MsgBox ChangeString("Mel\EGGER\mdf.p2m")
End Sub
Function ChangeString(s As String) As String
Dim i As Long
i = InStr(s, Application.PathSeparator)
s = Right(s, Len(s) - i + 1)
i = InStrRev(s, ".")
s = Left(s, i) & "png"
ChangeString = s
End Function