Autosize

K

kirkm

Anyone know why autosize sometimes increases label height
far in excess of what it should be? It occurs after the label text is
changed to something smaller, then restored to what it was.

Should this logic to reset work?. It isn't!

Set Autosize False
Set label1 = ""
Assign label1= newtextstring
Set Autosize True

Also when autosize causes descenders to be cropped, can you append a
blank line (to the label)?

Thanks - Kirk
 
O

OssieMac

Hi Kirk,

Firstly are you using MS Excel? The code you posted suggests you might be
using something else.

Anyway assuming it is MS Excel your first question: Try setting the property
Wordwrap to false. Excel becomes confused with Autosize if it is set to true
and then font sizes and length of text etc is changed.

Second question: Following code might help if you are using MS Excel.

Dim newtextstring As String

newtextstring = "My New Label Name"

'Label1.AutoSize = False 'Superfluous line.
'Label1.Caption = "" 'Superfluous line. Not required when changing caption
Label1.Caption = newtextstring
Label1.AutoSize = True
Label1.Font.Size = 12 ' Included for demo purposes only

Can also use following line in lieu of using a variable for the caption.
Label1.Caption = "My New Label Name"

Feel free to get back to me if still having problems but let me know what
version of Excel you are using
 
K

kirkm

On Sat, 22 Nov 2008 19:50:00 -0800, OssieMac

Hi Ossie
Firstly are you using MS Excel? The code you posted suggests you might be
using something else.

Sorry it wasn't actual code... but the things I'd been trying.

You've hit it on the nail... Wordwrap! Everything now works
perfectly... and I was also able to nail the descender problem. I
wasn't turning on the scrollbar at the exact right label Height.

Excel version 2002.

Thanks a million ! :)

Cheers - Kirk
 

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