can you get that value some how?
Printable View
can you get that value some how?
if you have a form or picturebox handy then it's easy
hope it helpsCode:Dim sngTextWidth As Single 'Width of text in whatever scalemode your form's in
Dim sngTextWidthTwips As Single 'width of text in twips
'Get the width of the form in some scalemode
sngTextWidth = Form1.TextWidth("Hello")
'Convert to twips
sngTextWidthTwips = Form1.ScaleX(sngTextWidth, Form1.ScaleMode, vbTwips)
MsgBox """Hello"" is " & sngTextWidthTwips & " Twips Wide."
Don't forget to set the form or picturebox font to the same font as the text you want to measure.
The other option is to use the GetTextExtent32 API call, but you still need a device context and a handle to a font object.
- gaffa