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 / May 2006

Tip: Looking for answers? Try searching our database.

Hierarchy of Objects in Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George B - 22 May 2006 19:58 GMT
Running Word 2000, I have a document with perhaps a half dozen paragraphs,
with two tables interspersed among the paragraphs.  If I have a loop:
  For Each p in ActiveDocument.Paragraphs
I cycle through all paragraphs, both inside and outside the tables.  I can
also:
 For Each t in ActiveDocument.Tables
and cycle through the tables.  Is there some property which tells me where
the tables occur among the top-level paragraphs?  How do I refer to the
paragraph before a table?

I am trying to write a customized conversion of all tables to text.  I am
successfully accessing the cells of the table and generating the replacement
text, but have not been able to generate a new paragraph to store the new
text.
Dave Lett - 22 May 2006 20:11 GMT
Hi,

Is there a reason you can't use .ConvertToText?

Dim lTbl As Long
For lTbl = ActiveDocument.Tables.Count To 1 Step -1
   ActiveDocument.Tables(lTbl).ConvertToText
Next lTbl

HTH,
Dave

> Running Word 2000, I have a document with perhaps a half dozen paragraphs,
> with two tables interspersed among the paragraphs.  If I have a loop:
[quoted text clipped - 11 lines]
> text, but have not been able to generate a new paragraph to store the new
> text.
George B - 22 May 2006 20:54 GMT
Hi, Dave

 I've tried ConvertToText but this doesn't do what I need.  Some of the
table cells have very long entries, requiring many lines to display.
ConvertToText puts all of the entry on one line; I'm trying to format each
row into multiple lines which look like the original display.

George B

> Hi,
>
[quoted text clipped - 23 lines]
> > text, but have not been able to generate a new paragraph to store the new
> > text.
Dave Lett - 23 May 2006 12:38 GMT
Hi George,

Let me suggest an alternative: instead of trying to show the multiple lines,
can you format the paragraph so that its right indent gives you the lines
that you want to preserve?

HTH,
Dave

> Hi, Dave
>
[quoted text clipped - 37 lines]
> new
>> > text.
Helmut Weber - 22 May 2006 21:16 GMT
Hi George,

>Is there some property which tells me where
>the tables occur among the top-level paragraphs?
???

>How do I refer to the paragraph before a table?
In case there is a paragraph before a table:
With ActiveDocument.Tables(1).Range
  MsgBox .Paragraphs.First.Previous.Range.Text
End With

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

 
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.