oops, i probably should have shown the sub that changes the flexgrid width too since they depend on eachother. here goes..
Public Sub AdjustFlexGridRowHeight(ByRef grid As MSFlexGrid, Optional ByRef rownum As Integer = -1)
'if rownum = -1 (or not specified), resizes all rows. Else, resizes the specified row
Dim i As Integer
Dim j As Integer
Dim LinesOfText As Integer
Dim OldLineNum As Integer
Const EM_GETLINECOUNT = &HBA
With frmMain
If (grid.Tag = ""

Then 'I use the grid's tag property to store textheight. This way, this routine can support multiple grids.
Set .Font = grid.Font
Set .txtDummy.Font = grid.Font
grid.Tag = .TextHeight("GENERIC TEXT"

End If
'My fgrids only have one column (col 0)
'grid.ColWidth(0) = grid.Width - 250 '250 helps keep text from being too close to the edge
'.txtDummy.Width = grid.ColWidth(0)
For i = 1 To (grid.Rows - 1)
Dim iWidth As Integer
If ((rownum = -1) Or (i = rownum)) Then
OldLineNum = 0
LinesOfText = 1
For j = 1 To (grid.Cols - 1)
.txtDummy.text = grid.TextMatrix(i, j)
LinesOfText = SendMessage(.txtDummy.hwnd, EM_GETLINECOUNT, 0&, 0&)
If LinesOfText < OldLineNum Then
LinesOfText = OldLineNum
End If
grid.RowHeight(i) = Val(grid.Tag) * LinesOfText
OldLineNum = LinesOfText
Next j
End If
Next i
txtEdit.Height = Grid1.CellHeight
Call ChangeWidth(Grid1, txtEdit)
End With
End Sub