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

Tip: Looking for answers? Try searching our database.

Check if a paragraph fits into a cell without "breaking" its height.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GD1 - 26 Sep 2006 18:57 GMT
How can I check if a paragraph fits into a cell without "breaking" its
height using VBA?

Thank you!
Cindy M. - 28 Sep 2006 08:37 GMT
Hi Gd1,

> How can I check if a paragraph fits into a cell without "breaking" its
> height using VBA?

Not easily, if at all. The .Information property of the Range/Selection
objects does provide a way to get the RelativeHorizontal position of a
"point". So you could get that from the end and start points, calculate
the difference, and compare it to the available cell width less cell
padding. But it's not *guaranteed* to work exactly. And if different
fonts are applied in the two places, all bets are off.

The better approach would probably be to put the paragraph into the cell
then count the number of lines.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
GD1 - 29 Sep 2006 07:04 GMT
> The better approach would probably be to put the paragraph into the cell
> then count the number of lines.

I thought the same. Counting the lines is the best solution. But how
can I know how many points is tall, for example, one line of Verdana
7pt?

Thank you!
Robert M. Franz (RMF) - 30 Sep 2006 22:16 GMT
> I thought the same. Counting the lines is the best solution. But how
> can I know how many points is tall, for example, one line of Verdana
> 7pt?

The easiest way seems to be to _define_ an exact line heigt for the
paragraph.

HTH
Robert
Signature

 /"\  ASCII Ribbon Campaign |   MS
 \ /                        |  MVP
  X        Against HTML     |  for
 / \     in e-mail & news   | Word

GD1 - 29 Sep 2006 07:04 GMT
> The better approach would probably be to put the paragraph into the cell
> then count the number of lines.

I thought the same. Counting the lines is the best solution. But how
can I know how many points is tall, for example, one line of Verdana
7pt?

Thank you!

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.