Calculating Control Height

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,058
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I have an InkEdit control in a Frame on a Userform and need to know it's height in order to position a label underneath it.
I had thought the count of linefeeds would serve but some line are wordwrapped in the control and not by a VBLF Character.
I tried setting a label with autosize On to the same font, width etc as the InkEdit control and the InkEdit height to the labels height. But this leaves too much land between the last row and the end (As shown up by the backcolor). It's also not consistent with differing numbers of rows.
Any help getting this right would be most welcome!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Sorry - I only just saw this now. That's probably what I would've done, but I would add that there is an API you can use to get the actual pixel width/height of a text string given the character length and font settings being used. I can dig that out if you still need it.
 
Upvote 0

Forum statistics

Threads
1,223,610
Messages
6,173,343
Members
452,510
Latest member
RCan29

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top