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"
 
Top