Trying to save copy of Paragraph-For Each para In doc.Paragraphs L

S

sippyuconn

I am trying to save a copy of a Paragraph to process later when
I loop to new paragraph

I tried this but get an error
LastPara = para

Is there another way to do this ???




Dim doc As Word.Document
Dim para As Word.Paragraph
Dim LastPara As Word.Paragraph


Set doc = ActiveDocument
For Each para In doc.Paragraphs
'Put the code here to manipulate the paragraph
 
S

Shauna Kelly

Hi

You need to use Set, as you did for the doc variable. So:
Set LastPara = para

For what it's worth, you don't use Set with simple variable types (string,
integer, long, boolean etc). You must use Set when you're assigning a
reference to an object (in this case a Word.Paragraph object) to a variable.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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