View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Bhimsen Bhimsen is offline
external usenet poster
 
Posts: 3
Default Character count of a Cell in a Table

I want to find out how many characters can a blank cell contain.(the cell
doesn't contain any text).
Once the marker is placed in the cell and the macros is run, is it possible
to find the number of characters the cell can contain maximum.(The Row height
is fixed and wrap text and fit text options have been disabled.)

"Lene Fredborg" wrote:

You may use the following as a starting point (I don't know how you want to
use the count).

The following line of code will show the number of characters in the first
cell in the selection, incl. the end of cell marker (which counts 2) €“ in
case of a single cell, you do not need to select the text first. It is
sufficient that the insertion point be in the cell:

MsgBox Len(Selection.Cells(1).Range)


If you want to exclude the end of cell marker, subtract 2 from the count:

MsgBox Len(Selection.Cells(1).Range) - 2

For example, if the cell contains the text "This is my text" (a total of 15
characters), the first code line will 17 and the second will return 15.

Please post back if you need help with the entire macro. In that case, you
need to explain how you want to use the macro.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Bhimsen" wrote:

Can we find the number of characters a cell may contain in a table by writing
a new macros ? If yes, how?