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

G

GD1

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

Thank you!
 
C

Cindy M.

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 :)
 
G

GD1

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!
 
G

GD1

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!
 
R

Robert M. Franz (RMF)

GD1 said:
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
 

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