ksilenio
09-21-2020, 02:08 PM
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
Paul_Hossler
09-21-2020, 04:36 PM
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
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
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.