Hi,
I'll see if I can describe this properly. I am experiencing strange behaviour in Excel 2007 where the AutoSize property of Labels seems to be causing some of the Label's Caption not to be displayed.
I have a UserForm that displays guidance/recommendations after another UserForm is completed/submitted. The guidance UserForm has 4 labels and their captions are set to different text strings depending on the values set by the first UserForm. Because the text strings are of varying lengths and because there is no built-in way to centre Caption text vertically in a Label (and because I want things to look nice) I have used the following VBA to set the string, autosize the inner label and then centre the inner label on the outer label:
NB - The background colour of both Labels should be the same colour, but I have temporarily changed one to white to see the border/size of the inner label
The size of the outer Label is W: 366, H: 54. The typeface used is Tahoma.
What happens with the code as above is that blocks A, B and C of the caption string display on one line, but block D does not display at all. There is clearly enough room for it to display on one line. It does display the whole string if you reduce the string by one character ("A0123456789 B0123456789 C0123456789 D012345678") and, crucially, it does display the whole string when you lengthen it - this displays this string: "A0123456789 B0123456789 C0123456789 D0123456789 E" on one line. Longer strings, including those which need to be / should be displayed over more than one line, seem to display without problems.
Most of my strings are longer than this and don't encounter any issues, but one of them seems to fall in this Twilight Zone; the last few words are not displayed. I could probably re-word the text to avoid the issue, but I would rather work out out what's going on.
Any ideas?
Bookmarks