Problem with Empty Paragaphs at the end of TXT files

J

jjfeenix

I have DOCs containing tables that are converted to text with asterisks as
the delimiter. I remove empty paras at the end of the files, because empty
paras equal empty records when these TXT files are feed into a reporting
system later.

The problem is that after saving as CRText and reopening I find 3 empty
paras. Why and how do I fix it? I can reopen the files, strip out the empties
and then resave, manually and they don't exhibit the extra empties. While I
could add code to this, I'm hoping there's an easier way.

BTW, the Header and footer are empty and there are no page numbers.

Here's the code I'm using for the save:

Application.DefaultSaveFormat = "CRText" ' forces "txt" style
save
ActiveDocument.Save
Application.DefaultSaveFormat = "" ' returns save
type to normal
ActiveDocument.Close

Thanks in advance
JohnS
 
F

Fumei2 via OfficeKB.com

Hard to say why it is specifically three paragraphs. You are converting
tables to text via code? Are you putting the asterisks in, or are they there
already? If you are using * as the deminiter, how are you ending up with
separate paragraphs (which I think you are saying)?

yadda* Blah* Whatever* Huh* (one row)

would end up as:

Yadda**Blah**Whatever**Huh* (one paragraph - not separate paragraphs)

Can you give a bit more detail?
 
J

jjfeenix

Thanks for the reply.

Via code I am select the table, and use Convert to Table with * as the
delimiter. This creates a doc with separate paragraphs corresponding to each
row of the original table. A sub checks for empty paragraphs at the end and
deletes them. Then saves the doc as a TXT file. All of this code is working
properly, confirmed by Stepping thru the procedures.

The problem is that after I save the file as TXT, when I open it again, it
now has 3 empty paragraphs at the end. If, after opening again, I manually
remove them and save as TXT again they do NOT appear on reopening the file.

Is there a known issue with saving a DOC file as TXT and getting empty
paragraphs because of the conversion? Maybe these are place holders for
header, footer and something else? However, my header and Footer IS Empty (I
check for that in code) and there are no page numbers in the original Doc.
 

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