Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[RESOLVED] Filename no extension, left of first "_"

$
0
0
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!

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>