height of can grow text box

K

Keith G Hicks

(this was previously in the "modulesdaovba" NG, but I decided to move it)

I'm trying to write code to calculate the height of a "can grow" text box
given a particular width, font name and font size. I found something on the
web that doesn't work for some reason
(http://www.experts-exchange.com/Databases/MS_Access/Q_20898220.html). So
I'm currently using automation to send the text into a text frame in a word
doc and then resizing the text frame and getting the height of that. IT
works quite well in office 2003. But it doesn't work in office 2000.
Apparantly the TextFrame.Autosize function is not part of 2000. I'd prefer
to do the whole thing from within Access without using word but not sure
that is possible. I also have tried to figure out some code to do it in
word without using a textframe. It works but doesn't seem as accurate as I'd
hoped. I'm sure I'm doing something a little wrong in there. In any event
I was wondering if anyone knows of a good way to do this strictly in ms
access. Any help would be appreciated. It seems a shame that MS hasn't
after all these versions of Access just included a property of can grow text
boxes that can be used in the OnFormat event of a report.

Thanks,

Keith
 
S

Stephen Lebans

See:
http://www.lebans.com/textwidth-height.htm
TextHeightWidth.zip is a replacement for the Report object's TextWidth
and TextHeight methods. It is multiline aware and can work in both
Report and Form views. Includes a sample report to show you how to
autosize individual controls with different formatting on the same line
to simulate RTF style text.



But if you just want to draw borders/lines then simply use the Line
method of the Report object int he section's Print event.
http://www.lebans.com/PrintLines.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
K

Keith G Hicks

That worked. Thanks. Now my problem is that I can't measure it in Arial
7.5. Access will only allow me to use whole number font sizes. I have to
get the height of a text box that is using Arial 7.5. Word will let me do
that. Might have to cave in and do this in some way in word after all. Ugh.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top