#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default Autosize


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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Autosize

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

--
Regards,

OssieMac


"kirkm" wrote:


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default Autosize

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

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
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
ComboBox autosize GIP Excel Worksheet Functions 0 August 21st 10 04:50 PM
Autosize Error willemeulen Excel Discussion (Misc queries) 0 February 25th 10 12:17 PM
autosize Learning the hard way Excel Programming 2 May 25th 06 02:16 PM
Autosize Row Heights Andibevan Excel Discussion (Misc queries) 6 May 11th 05 01:45 PM
comments AutoSize CG Rosén Excel Programming 2 November 29th 03 11:20 AM


All times are GMT +1. The time now is 09:22 AM.

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"