Add Headers and Footers via VB?

February 24, 2016 at 09:15:31
Specs: Windows 7
Is it easy to add headers and footers via Visual Basic?

I'm currently using Batch (BAT file) but someone told me that if I wanted to be able to have the input files to have wildcard capabilities it would be better to use Visual Basic.

All my input files will always start with COMRECIN but the extension will be different - COMRECIN.001, COMRECIN.002, COMRECIN.003 and so on.

Also is it possible to have the numbers incremented in a script as well? So say for instance - have the input file always have the same name but have the output file always look to see the last file in the folder and then increment the new one?


See More: Add Headers and Footers via VB?

Report •


#1
February 25, 2016 at 21:21:12
I've seen all 3 of your posts, and I suspect you've got a rough idea what you're looking for, but not specific enough to actually put code to file.

mklindquist: Is it easy to add headers and footers via Visual Basic?
About as easy as any other language. That is to say, it depends on the file, and what you're expecting to do with it.

mklindquist: someone told me that if I wanted to be able to have the input files to have wildcard capabilities it would be better to use Visual Basic.
Why, exactly? Most CMD commands have no problems with wild cards.

mklindquist: have the input file always have the same name but have the output file always look to see the last file in the folder and then increment the new one?
If by this you mean incrementing the extension by one until a unique name is found, it's as simple as a recursive function that calls Scripting.FileSystemObject.FileExists().

mklindquist: I'm curious how the footer would work since I will not know the line everytime.
Why not? Actually, are these well-formed XML files? If so, it'd probably be easier to use a command-line based XML editor. I don't know of one, but I'm sure they're out there. VBScript can use Microsoft.XMLDOM. If not, and I'm asking because your example header is not valid XML, you'll have to handle that logic yourself.

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question