Measuring a text extent It×¢ÊÍ£ºs very simple to determine the extent of a string in VB. You can do so with WinAPI functions, but there×¢ÊÍ£ºs an easier way: Use the AutoSize property of a Label component. First, insert a label on a form (labMeasure) and set its AutoSize property to True and Visible property to False. Then write this simple routine: Private Function TextExtent(txt as String) as Integer labMeasure.Caption = txt TextExtent = labMeasure.Width End Function When you want to find out the extent of some text, simply call this function with the string as a parameter. In my case it turned out that the measure was too short. I just added some blanks to the string. For example: Private Function TextExtent(txt As String) As Integer labMeasure.Caption = " " & txt TextExtent = labMeasure.Width End Function