Zuccj
08-01-2017, 09:54 AM
I'm working on a quick script that will export some data from excel into a text file. I have it all working, but I would like to be able to tell if the file already existed, or if it had to be created. The reason for this is if the file I was created I would like to add a header to the text file, so each column is able to be read quickly. If the file already existed, then there will be a header and no need for the header to be applied.
Dim fs, f
Set fs = CreateObject("scripting.FileSystemObject")
Set f = fs.opentextfile("C:\..." & part & ".txt", 8, True, TristateUseDefault))
f.write ....
f.writeline
f.Close
part is the part number which is taken from a cell, which is also the name of the text file.
Dim fs, f
Set fs = CreateObject("scripting.FileSystemObject")
Set f = fs.opentextfile("C:\..." & part & ".txt", 8, True, TristateUseDefault))
f.write ....
f.writeline
f.Close
part is the part number which is taken from a cell, which is also the name of the text file.