Hot to put whjole text into a string?

  • Thread starter jumpjack via OfficeKB.com
  • Start date
J

jumpjack via OfficeKB.com

If I select the whole document and I write:
a$ = selection.text
I will NOT have the whole document into the variable, but just the FIRST
PARAGRAPH!!!

How can I store the whole document into one variable?
Or, how can I parse all paragrpahs one by one?
 
H

Helmut Weber

Hi,

BTW, a greeting and a name wouldn' do any harm, would it?
I will NOT have the whole document into the variable,
but just the FIRST PARAGRAPH!!!

How can I store the whole document into one variable?

So You want to know how to do what don't want to do?


Sub test8001()
Dim strPrg As String
Dim objPpg As Paragraph
For Each objPrg In ActiveDocument.Paragraphs
strPrg = objPrg.Range.Text
MsgBox strPrg
' Includes the paragaph mark
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