What's the best way of writting a text file through VBA?

G

Guest

I have to create several text files through VBA every month, and the text
files have to be created line by line. What I do right now is to write to the
text file everytime I created a new line for this text file. And it became
extremely slow when everything is located on a network drive. I am guessing
the major reason is because writing to the network drive frequently makes the
process slow.

So I am thinking about if it is possible to put the data for the text file
in a buffer and then save it to the network drive only once. The text file is
not huge, its size is just about 3M. Saving a 3M file on the network drive
should just take a few seconds, at most 1 minute.

Could anybody help me on this problem? Thanks a lot!
 
D

Dave Peterson

So why not write to your C: drive (maybe a temp folder) and just move the file
to the network drive when you're done?

Look at Name Statement in VBA's help:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top