I have a file which is manually added or modified based on the inputs. Since most of the contents are repetitive in that file, only the hex values are changing, I want to make it a tool generated file.
I want to write the c codes which are going to be printed in that .txt file.
What is the command to create a .txt file using VBA, and how do I write to it
More Information:
Open
statementPrint #
statementClose
statementPrint
StatementWorkbook.Path
propertyan easy way with out much redundancy.
Use FSO to create the file and write to it.
See the documentation here:
To elaborate on Ben's answer (since improving it doesn't seem to be allowed):
If you add a reference to
Microsoft Scripting Runtime
and correctly type the variable fso you can take advantage of autocompletion (Intellisense) and discover the other great features ofFileSystemObject
.Here is a complete example module: