sending array paragraphs to my document

F

filo666

Hello, I have 1378 paragraphs saved on an array, I need to send them to a
word document, my program took 3 hr so to finish getting the array data, so I
dont want to cancel the maro that is on stand by, I have no idea how to send
the data to my new document and I can not make test so to find out how, could
someone tell me how to do it fast because I'm stock and I can not continue
with my work,
TIA
 
H

Helmut Weber

Hi Filo,

loop over all items in your array
for lngCnt = 0 to ubound(MyArr) -1
activedocument.range.insertafter myarr(lngCnt) & vbCr
next

Untested, due to a lack of sufficient testing material.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
F

filo666

thanks Helmut, it worked, I have another question; I'm runing a macro that
eliminates all the paragraphs that start with ++, the code brakes down when I
have paragraphs with no information (any letters or characters, like if the
enter key was pressed), I though about

if ativedocument.paragraphs(n).range="" then
paragraphs(n).delete
end if

and the for structure could continue

but it didn't work out

any suggestions??

TIA
 
H

Helmut Weber

Hi filo666,

Sub Test567()
Dim oPrg As Paragraph
For Each oPrg In ActiveDocument.Paragraphs
If Left(oPrg.Range.Text, 2) = "++" Then
oPrg.Range.Select ' or delete or whatever
End If
Next
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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