[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!
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.