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

Tip: Looking for answers? Try searching our database.

Cell height when text is wrapped

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Francis Hookham - 27 Apr 2006 16:25 GMT
1
Rows in the third column of table pasted into Word 2000 from XL has text
wrapped in many cells but the (row) height of the individual cells does not
always equal what it should be for the number of wrapped rows of text in the
cell. Often even a single row cell is deeper that it should be

Can anyone suggest a macro which would check how deep a cell should be for
the amount of wrapping and set the row accordingly

I have to do this regularly and it is tedious manually dragging each row to
suit - Office 2000 on this PC but could use 2002 on laptop

2
How does one write a while/wend to run down the third column - is there a
way of
determining how many rows there are?

Francis Hookham

PS
I posted this question to the microsoft.public.word.programming newsgroup
two weeks ago but no one has responded
Jezebel - 28 Apr 2006 09:56 GMT
1. This is actually quite tricky. (And if you trawl the archive you'll see
that you're not the first to ask.) You can use the Information() property to
check your vertical position on the page: so test the first and last words
in the cell, then adjust the row height to accommodate the difference.

2. While ... Wend is kind of obsolete. Do ... Loop is a better construction.
If your table is uniform (no merged or split cells), you can use For ...
Next also ---

For pRow = 1 to Table.Rows.Count
   Set pCell = Table.Cell(pRow, 3)
   :
Next

If you know nothing about the structure of the table, use something like

Set pCell = Table.Cell(1,1)
Do
   if pCell.ColumnIndex = 3 then
       ... we're in column 3
   end if
   set pCell = pCell.Next
Loop until pCell is nothing

> 1
> Rows in the third column of table pasted into Word 2000 from XL has text
[quoted text clipped - 21 lines]
> I posted this question to the microsoft.public.word.programming newsgroup
> two weeks ago but no one has responded
Jean-Guy Marcil - 28 Apr 2006 15:31 GMT
Francis Hookham was telling us:
Francis Hookham nous racontait que :

> 1
> Rows in the third column of table pasted into Word 2000 from XL has
[quoted text clipped - 7 lines]
> I have to do this regularly and it is tedious manually dragging each
> row to suit - Office 2000 on this PC but could use 2002 on laptop

Have you tried simply selecting the whole table, then get to the table
properties dialog?
On the row tab, set the rows to a height "At least" of a value of 12 points
(or whatever represents the font size in the table).

Normally, when you set the row height to "At least" smaller then needed, you
should not get any empty space at the end of the cell, unless there are
empty ¶ in the cells, a single ¶ just before the ¤ (end of cell marker) or
another cell in the same row that contains more text.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Francis Hookham - 28 Apr 2006 21:46 GMT
Merci - the following does it nicely

Sub CheckRowHeight()
   Application.ScreenUpdating = False
   Selection.Tables(1).Select
   Selection.Rows.Height = wdRowHeightAtLeast
   Selection.Rows.Height = InchesToPoints(0.01)
   Selection.HomeKey Unit:=wdStory
End Sub

> Francis Hookham was telling us:
> Francis Hookham nous racontait que :
[quoted text clipped - 20 lines]
> are empty ¶ in the cells, a single ¶ just before the ¤ (end of cell
> marker) or another cell in the same row that contains more text.

Rate this thread:






 
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.