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
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
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
Last edited by Paul_Hossler; 09-21-2020 at 05:56 PM.
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3