Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.printing,microsoft.public.excel.programming,microsoft.public.word.pagelayout,microsoft.public.word.vba.general
external usenet poster
 
Posts: 3
Default String width in specified font/size when merging

Hello,

I am merging documents with fields from an Excel sheet.
I need to put some text (from Excel) into boxes pre-printed on the paper,
the boxes have fixed sizes.

The problem is that some datas in the Excel sheet doesn't fit in the boxes,
and because I am using non-fixed fonts the values of the datas are changing
the width of the text (MMMMM vs IIIII).

My goal is to do a macro (in Excel or Word) to tell me which records doesn't
fit in a XX centimeters box when using a specific font/size (and then I can
modify manually the datas in Excel when it's too large).

I searched how to get the real printed width (or any value with a fixed
ratio value/real_printed_width) of a string but I can't find any information
about it.

Thank you VERY VERY much in advance, ANY help is REALLY appreciated.
Seb.

PS: sorry for my bad English, it is not my first language.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default String width in specified font/size when merging

In Visual Basic proper (not VBA), the property you would use is TextWidth.
That seems not to be available in Excel VBA or Word VBA, either.

IIRC, one suggestion is to put the text in a cell in a column that is
otherwise empty, then AutoFit the column and determine the width. That's a
real kludge, and would probably be slow, also.

On Sun, 24 Oct 2004 03:19:07 +0200, "Seb" wrote:

Hello,

I am merging documents with fields from an Excel sheet.
I need to put some text (from Excel) into boxes pre-printed on the paper,
the boxes have fixed sizes.

The problem is that some datas in the Excel sheet doesn't fit in the boxes,
and because I am using non-fixed fonts the values of the datas are changing
the width of the text (MMMMM vs IIIII).

My goal is to do a macro (in Excel or Word) to tell me which records doesn't
fit in a XX centimeters box when using a specific font/size (and then I can
modify manually the datas in Excel when it's too large).

I searched how to get the real printed width (or any value with a fixed
ratio value/real_printed_width) of a string but I can't find any information
about it.

Thank you VERY VERY much in advance, ANY help is REALLY appreciated.
Seb.

PS: sorry for my bad English, it is not my first language.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default String width in specified font/size when merging

The problem is that Excel and Word doesn't display the same text (in the
same font/size) identically.

Example:
If you put 40 "M" and 110 "I" in two cells under Excel in Times New Roman/12
the "M" line is greater than the "I" line. If you do the same under Word the
"I" line is greater than the "M" line.
When you print the two lines (both Excel and Word) the "I" line is greater
than the "M" line.

I don't know if it's a bug in Excel or if it's a "visual effect" but the
conclusion is that I can't trust the column width value.

On the MSDN the TextWidth method is used for Reports, so I need Visual Basic
+ Access to use it and I'm not sure that it is giving good values.

I continue searching, thank you for your suggestions.
Seb.

"Myrna Larson" a écrit dans le message
de news: ...
In Visual Basic proper (not VBA), the property you would use is TextWidth.
That seems not to be available in Excel VBA or Word VBA, either.

IIRC, one suggestion is to put the text in a cell in a column that is
otherwise empty, then AutoFit the column and determine the width. That's a
real kludge, and would probably be slow, also.

On Sun, 24 Oct 2004 03:19:07 +0200, "Seb" wrote:

Hello,

I am merging documents with fields from an Excel sheet.
I need to put some text (from Excel) into boxes pre-printed on the paper,
the boxes have fixed sizes.

The problem is that some datas in the Excel sheet doesn't fit in the
boxes,
and because I am using non-fixed fonts the values of the datas are
changing
the width of the text (MMMMM vs IIIII).

My goal is to do a macro (in Excel or Word) to tell me which records
doesn't
fit in a XX centimeters box when using a specific font/size (and then I
can
modify manually the datas in Excel when it's too large).

I searched how to get the real printed width (or any value with a fixed
ratio value/real_printed_width) of a string but I can't find any
information
about it.

Thank you VERY VERY much in advance, ANY help is REALLY appreciated.
Seb.

PS: sorry for my bad English, it is not my first language.




  #4   Report Post  
Posted to microsoft.public.excel.printing,microsoft.public.excel.programming,microsoft.public.word.pagelayout,microsoft.public.word.vba.general
external usenet poster
 
Posts: 3
Default String width in specified font/size when merging

I remarqued something very strange.

In Word (2000 & 2003) the "I" line is greater than the "M" line when viewing
and printing.
In Excel when viewing the "M" line is greater but when printing the "I" line
is greater like in Word !!!

Buggy Excel :)

"Seb" a écrit dans le message de news:
...
Hello,

I am merging documents with fields from an Excel sheet.
I need to put some text (from Excel) into boxes pre-printed on the paper,
the boxes have fixed sizes.

The problem is that some datas in the Excel sheet doesn't fit in the
boxes, and because I am using non-fixed fonts the values of the datas are
changing the width of the text (MMMMM vs IIIII).

My goal is to do a macro (in Excel or Word) to tell me which records
doesn't fit in a XX centimeters box when using a specific font/size (and
then I can modify manually the datas in Excel when it's too large).

I searched how to get the real printed width (or any value with a fixed
ratio value/real_printed_width) of a string but I can't find any
information about it.

Thank you VERY VERY much in advance, ANY help is REALLY appreciated.
Seb.

PS: sorry for my bad English, it is not my first language.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
change font size on screen, but prints in old size lvrcdval Excel Discussion (Misc queries) 2 July 19th 07 02:36 PM
Change all text one font size up with various font sizes used. omchrystal New Users to Excel 2 March 6th 07 09:01 PM
My tabs' font size is smaller - how do I restore default size? katykins53 Excel Discussion (Misc queries) 1 January 11th 06 12:07 AM
Font size prints same size regardless of how I set it in Excel Marcusmouse Excel Discussion (Misc queries) 2 May 26th 05 03:25 PM


All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"