Word VBA question

T

Ted

Hi, i'm importing some text into a database. unfortunately there are no end
of
record characters so i need to force a return character at the end of every
record.
if i don't Access XP thinks that it is one continuous record and it hangs
up. does
anyone know of any code in Word VBA that will allow me to add a EOR
character
every 4096 characters?

Thank you in Advance
Ted
 
G

geneus

Sub CountIt()

ParaCount = ActiveDocument.Paragraphs.Count
WordCount = ActiveDocument.Characters.Count
Lnumber = 4096
z = WordCount / Lnumber

Selection.HomeKey Unit:=wdStory

For x = 1 To z

With ActiveDocument.Paragraphs(x)
..Range.Characters(4096).Select
End With

With Selection
.InsertAfter Chr(13)
End With

Next x

End Sub

-Gene
 

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