Public Sub ReSizeCellHeight(MyRow As Long, MyCol As Long)
Dim LinesOfText As Long
Dim HeightOfLine As Long
'Set MSFlexGrid to appropriate Cell
OrderGrid.Row = MyRow
OrderGrid.Col = MyCol
'Set textbox width to match current width of selected cell
txtAdjuster.Width = OrderGrid.ColWidth(MyCol)
'Set font info of textbox to match FlexGrid control
txtAdjuster.Font.Name = OrderGrid.Font.Name
txtAdjuster.Font.Size = OrderGrid.Font.Size
txtAdjuster.Font.Bold = OrderGrid.Font.Bold
txtAdjuster.Font.Italic = OrderGrid.Font.Italic
txtAdjuster.Font.Strikethrough = OrderGrid.Font.Strikethrough
txtAdjuster.Font.Underline = OrderGrid.Font.Underline
'Set font info of form to match FlexGrid control
Me.Font.Name = MSFlexGrid1.Font.Name
Me.Font.Size = MSFlexGrid1.Font.Size
Me.Font.Bold = MSFlexGrid1.Font.Bold
Me.Font.Italic = MSFlexGrid1.Font.Italic
Me.Font.Strikethrough = MSFlexGrid1.Font.Strikethrough
Me.Font.Underline = MSFlexGrid1.Font.Underline
'Put the text from the selected cell into the textbox
txtAdjuster.Text = Trim$(OrderGrid.Text)
'Get the height of the text in the textbox
HeightOfLine = Me.TextHeight(txtAdjuster.Text)
'Call API to determine how many lines of text are in text box
LinesOfText = SendMessage(txtAdjuster.hwnd, EM_GETLINECOUNT, 0&, 0&)
'Check to see if row is not tall enough
If OrderGrid.RowHeight(MyRow) < (LinesOfText * HeightOfLine) Then
'Adjust the RowHeight based on the number of lines in textbox
OrderGrid.RowHeight(MyRow) = (LinesOfText) * HeightOfLine
End If
End Sub