Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Lloyd Catlett Lloyd Catlett is offline
external usenet poster
 
Posts: 12
Default How to determine minimum width of textbox for some text

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
JERRY JERRY is offline
external usenet poster
 
Posts: 288
Default How to determine minimum width of textbox for some text

Why do you want to "calculate" the size of the box? Just grab a corner of the
box and stretch it until the text fits. Then go to Format - Text Box and
check to see what size it is.

"Lloyd Catlett" wrote:

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
JERRY JERRY is offline
external usenet poster
 
Posts: 288
Default How to determine minimum width of textbox for some text

Why do you want to "calculate" the size of the box? Just grab a corner of the
box and stretch it until the text fits. Then go to Format - Text Box and
check to see what size it is.

"Lloyd Catlett" wrote:

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How to determine minimum width of textbox for some text

Use a frame or a table cell and the height of the 'box' can be configured to
adapt to the amount of text.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Lloyd Catlett" wrote in message
...
With given text I want to calculate the minimum width (and height) needed
in
a textbox to contain the text. I suppose it depends on the font (duh!),
but
how would I do the calculation?

Word 2000, XP
--
L. Catlett



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How to determine minimum width of textbox for some text


Use a frame or a table cell and the height of the 'box' can be configured to
adapt to the amount of text.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Lloyd Catlett" wrote in message
...
With given text I want to calculate the minimum width (and height) needed
in
a textbox to contain the text. I suppose it depends on the font (duh!),
but
how would I do the calculation?

Word 2000, XP
--
L. Catlett





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Lloyd Catlett Lloyd Catlett is offline
external usenet poster
 
Posts: 12
Default How to determine minimum width of textbox for some text

Thanks for asking, Jerry. I've some code in VBA Word that creates a
cartesian coordinate grid (graph grid) of user-defined size on which I plot a
function. One of the things I do is give the user the option to number the
x-axis and y-axis. To number the axis I create a textbox and set the text to
whatever number is needed (such as "-5"). Since the text can be of different
lengths I have to set the textbox width and height in the code. If I set the
width too wide the scale numbers will overlap; too small and the text won't
fit. If I can find a way to calculate the minimum width (and height) of the
text I have more options available about how to size the textbox. I set the
textbox width with the line of code
"Selection.ShapeRange.Width = WidthNeeded"; I need a way to calculate
WidthNeeded.

--
L. Catlett


"Jerry" wrote:

Why do you want to "calculate" the size of the box? Just grab a corner of the
box and stretch it until the text fits. Then go to Format - Text Box and
check to see what size it is.

"Lloyd Catlett" wrote:

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett

  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Lloyd Catlett Lloyd Catlett is offline
external usenet poster
 
Posts: 12
Default How to determine minimum width of textbox for some text

Thanks for asking, Jerry. I've some code in VBA Word that creates a
cartesian coordinate grid (graph grid) of user-defined size on which I plot a
function. One of the things I do is give the user the option to number the
x-axis and y-axis. To number the axis I create a textbox and set the text to
whatever number is needed (such as "-5"). Since the text can be of different
lengths I have to set the textbox width and height in the code. If I set the
width too wide the scale numbers will overlap; too small and the text won't
fit. If I can find a way to calculate the minimum width (and height) of the
text I have more options available about how to size the textbox. I set the
textbox width with the line of code
"Selection.ShapeRange.Width = WidthNeeded"; I need a way to calculate
WidthNeeded.

--
L. Catlett


"Jerry" wrote:

Why do you want to "calculate" the size of the box? Just grab a corner of the
box and stretch it until the text fits. Then go to Format - Text Box and
check to see what size it is.

"Lloyd Catlett" wrote:

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett

  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Lloyd Catlett Lloyd Catlett is offline
external usenet poster
 
Posts: 12
Default How to determine minimum width of textbox for some text

Found an way!

Perhaps this is what Graham mayor meant with his suggestion.

Here's how I determine the (minimum) width and height required for specific
text:
a. create the textbox with .Shapes.AddTextbox
b. set font name, font size and the specific text I am working with with
Selection.Font.Name, .Font.Size, and .Text =
c. set margins to zero with ShapeRange.TextFrame.MarginLeft=, etc.
d. Turn AutoSize on by Selection.ShapeRange.TextFrame.Autosize=True
e. Get the minimum width and height with ShapeRange.Width, .Height


Maybe this will help anyone else looking for this capability. Thanks to
those who responded to my question!
--
L. Catlett


"Lloyd Catlett" wrote:

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett

  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Lloyd Catlett Lloyd Catlett is offline
external usenet poster
 
Posts: 12
Default How to determine minimum width of textbox for some text


Found an way!

Perhaps this is what Graham mayor meant with his suggestion.

Here's how I determine the (minimum) width and height required for specific
text:
a. create the textbox with .Shapes.AddTextbox
b. set font name, font size and the specific text I am working with with
Selection.Font.Name, .Font.Size, and .Text =
c. set margins to zero with ShapeRange.TextFrame.MarginLeft=, etc.
d. Turn AutoSize on by Selection.ShapeRange.TextFrame.Autosize=True
e. Get the minimum width and height with ShapeRange.Width, .Height


Maybe this will help anyone else looking for this capability. Thanks to
those who responded to my question!
--
L. Catlett


"Lloyd Catlett" wrote:

With given text I want to calculate the minimum width (and height) needed in
a textbox to contain the text. I suppose it depends on the font (duh!), but
how would I do the calculation?

Word 2000, XP
--
L. Catlett

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Minimum length in Text Form Field Options? ArcticWolf Microsoft Word Help 2 September 21st 09 05:11 PM
TextBox with Fixed Width and Autosized Height hr38581 Microsoft Word Help 4 August 5th 08 08:21 PM
Textbox - Text duplication [email protected] New Users 4 July 9th 06 07:01 PM
Forms text field minimum width LWert Microsoft Word Help 1 December 28th 04 09:02 PM
Minimum column width you can do on Word? Ace Tables 9 November 8th 04 11:44 PM


All times are GMT +1. The time now is 12:50 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"