My code creates a textbox on some worksheets in the Worksheet_SelectionChange under certain conditions. Here is a snipped of the relevant code. (I haven't included the entire sub because it is quite long.)
It works just as it should most of the time, but I've noticed at certain zoom levels of the sheet, if there is more than 1 "line" that appears in the text box (sometimes I go to a new line in the string it is displaying using vbnewline), the last line of text won't be displayed. It works fine at 100% zoom, and also at 80% zoom, but I've noticed at 90% it won't display the last line of the textbox. The height of the textbox looks the way it should, but in the space where the last line should be, there is nothing. If I change the zoom, it looks correct.
I assume this is a bug in Excel, but I'm wondering if anyone knows of a work-around, via VBA, to make all the text display as it should at ALL zoom levels?
VBA Code:
Set TB = ThisWorkbook.Sheets("Page 1").Shapes.AddTextbox(msoTextOrientationHorizontal, LeftPosition, TopPosition, 2, 2)
TB.TextFrame2.AutoSize = msoAutoSizeShapeToFitText
TB.TextFrame2.WordWrap = False
TB.TextFrame.Characters.Text = StringVar
It works just as it should most of the time, but I've noticed at certain zoom levels of the sheet, if there is more than 1 "line" that appears in the text box (sometimes I go to a new line in the string it is displaying using vbnewline), the last line of text won't be displayed. It works fine at 100% zoom, and also at 80% zoom, but I've noticed at 90% it won't display the last line of the textbox. The height of the textbox looks the way it should, but in the space where the last line should be, there is nothing. If I change the zoom, it looks correct.
I assume this is a bug in Excel, but I'm wondering if anyone knows of a work-around, via VBA, to make all the text display as it should at ALL zoom levels?