#1
|
|||
|
|||
Limit text length Content Control
Hi to all, is there any possibility to limit the max. lenght of a Plain Text Content Control? Using Legacy Tools is is easy to set a max. lenght but how can I achieve this with the corresponding Content Control? Thanks for any help NP |
#2
|
||||
|
||||
You'd need to use a ContentControlOnExit macro to examine the content and make whetever changes you require. Of course, if the user doesn't exit the content control, you'll end up with the excess content.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks for your answer, but that's not the solution I've been looking for
NP |
#4
|
||||
|
||||
That's just the way it is, sometimes.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
You can't always get what you want ...
|
#6
|
||||
|
||||
This isn't what you want, either, but ...
You could try putting the content control inside a table cell with fixed dimensions (add or remove borders as desired). Even if people add excessive amounts of text, it won't show up when it is being typed into the bottom margin of the cell.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#7
|
|||
|
|||
Hey, that's really a great idea, but it generates a new question: a VBA one.
As I create forms using VBA procedures it would be nice if I could also create the necessary tables (width of cells) on the basis of font and fontsize. Do you know any fomula how to calculate table width according to font, font size, bold? Unfortunately I'm not familiar with fonts issues. Otherwise tables would not really help Thx NP |
#8
|
|||
|
|||
Whoa!!! I think we just left Kansas!
You will get a wider response to your recent question if you post it in the vba forum with an appropriate question title. Some of the people best able to provide solutions on this are unlikely to see your detour here. |
#9
|
|||
|
|||
A table isn't going to be able to help you specify an exact number of characters, only an exact width (a capital W is much wider than a lower case i, so you can fit many more i's into the same width as a few W's). Unless you use a monospaced font where all characters are the same width, but those don't read as well as proportional fonts.
|
#10
|
||||
|
||||
It can probably be done with a macro, but you'd have to ask elsewhere, as Charles suggested.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#11
|
||||
|
||||
Yes, testing the string width can be done with a macro, quite easily in fact. But the point remains that the macro won't fire until you exit the content control, which brings you right back to the original problem that I set out in post #2.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Move to next content control | cksm4 | Word VBA | 13 | 07-02-2019 07:48 PM |
Deleting a table from a content control -- preserving the content control | BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |
Hierarchical content control | ntjson | Word VBA | 1 | 04-04-2013 12:07 AM |
Content control titles | jillapass | Word VBA | 3 | 05-29-2012 06:11 AM |
Retrieving content control value | jillapass | Word VBA | 4 | 05-24-2012 05:07 AM |