-
Jan 28th, 2013, 12:51 PM
#1
Thread Starter
New Member
[RESOLVED] Filename no extension, left of the first "_"
I am trying to return a portion of a filename.
This is what I have written:
ActiveCell.FormulaR1C1 = ActiveWorkbook.name & " " & Format(Now(), "mm/yyyy")
My filenames come through like this:
MacroTest_DoNotUse_OrOpen.xlsx 01/2013
I want to only return "MacroTest". The desired result will only return the portion of the filename to the left of the first "_" reading left to right. I can write this in Excel, but having trouble in VBA. If anyone has a solution I appreciate it!
-
Jan 28th, 2013, 03:25 PM
#2
Thread Starter
New Member
Re: Filename no extension, left of the first "_"
ActiveCell.FormulaR1C1 = Left(ActiveWorkbook.name, InStr(ActiveWorkbook.name, "_") - 1) & " " & Format(Now(), "mm/yyyy")
Posting my own solution.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|