Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Exporting a batch of Word documents as CSV files

Dec 5, 2005 5:55AM PST

In Word, to export a file as data for forms (CSV text file) you click Tools>>Options>>Save TAB>>then check the box ''Save Data for Forms''.

You then Save the file as a .TXT.

Is there a way to perform this operation to a group of 30 Word documents that are in a folder without opening each file?

I want the .TXT filename to be the same as the corresponding .DOC filename.

Thanks.

Discussion is locked

- Collapse -
Try writing a macro and put it in normal.dot
Dec 5, 2005 8:30PM PST

It's much easier if the filenames are fixed (always the same).

A simpler solution would be to write a macro for one file only. But then you must open each file and execute the macro manually.
If you like you could write a batchfile with 30 calls of Word (use start /w) and a command line option to execute that macro.

Kees

- Collapse -
Thanks Kees!
Dec 6, 2005 7:16AM PST

Thank you for your solution!

As I am applying the macro to each of the 30 files, I'm running into a naming issue. I do not care what the name of the files are, just so they are not the same, because each file is overwriting the previous from the VBA code:


ActiveDocument.SaveAs FileName:="file000.txt", FileFormat:=wdFormatText, _


How can I get the files saved as File0001.txt, then the next one File0002.txt, File0003.txt, etc.

Can VBA implement a Macro Execution counter where I could use:

ActiveDocument.SaveAs FileName:=vCounter, FileFormat:=wdFormatText,

?

- Collapse -
Re: VBA
Dec 6, 2005 5:21PM PST

Find the filename of the current document, and replace .doc with .txt.
You'll need to do a little bit of programming, I'm afraid.

Kees