Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Can we find the number of characters a cell may contain in a table by writing
a new macros ? If yes, how? |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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? |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Is the table part of a protected form that is going to be filled in?
I am not sure you can find a good method. Maybe others will come up with a solution you like. Unless you are using a monospaced font, characters have different widths (i and m). Also, the user could hit Return. In case of a text form field, you could set a maximum length of the text via Text Form Field Options. Even if the user enters text that breaks into more lines so that part of the text is not visible, you can still access all the text via VBA. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Bhimsen" wrote: 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? |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Character Count with spaces | Microsoft Word Help | |||
Character Limitation - a table cell in Word 2003 | Tables | |||
can not remove 26 pt character spacing in word table cell | Tables | |||
End of table cell character. | Microsoft Word Help | |||
Word count in Word table cell wrong if whole cell selected | Tables |