I'm trying to write some vba code that sends a line of code to the command prompt and executes it. I have that part down, but I need help getting the actual code to work.
I want to list all of the files in a specific folder that are the .doc file extension, but I want to exclude the first three characters of the filename that gets printed to my output text file. (Note: I'm using vba because this is one of several different commands I'd like to get into a single vba macro, and batch files are blocked for me so I'd like to work directly with the command prompt)
The following code works and gives me the file names without the file extension (ie. ABC201704.doc will return as ABC201704)
%comspec% /c for %i in (C:\Test\ABC*.doc) do @echo %~ni >> C:\Test\Output.txt
However, I don't know how to modify this so that it doesn't include the first 3 characters (ie. it would return 201704 instead of ABC201704). Any help would be greatly appreciated! I tried using the following link, but I couldn't figure out how to get that to work for my situation.