Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sippyuconn - 06 Aug 2007 02:26 GMT
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
       .
       .
       'Save copy of Paragraph
       LastPara = para

   Next
Shauna Kelly - 06 Aug 2007 05:03 GMT
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

>I am trying to save a copy of a Paragraph to process later when
> I loop to new paragraph
[quoted text clipped - 17 lines]
>
>    Next
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.