I did something similar for a combo
Private Sub cboFoodIDFK_GotFocus()
'Debug.Print Me.cboFoodIDFK.ColumnWidths
TempVars("FoodWidth").Value = Me.cboFoodIDFK.Width
'Debug.Print "GotFocus " & TempVars("FoodWidth").Value
Me.cboFoodIDFK.Width = "8000"
Me.cboFoodIDFK.ColumnWidths = ExpandCombo(Me.cboFoodIDFK.ColumnWidths)
End Sub
Private Sub cboFoodIDFK_LostFocus()
'Debug.Print "LostFocus " & TempVars("FoodWidth").Value
Me.cboFoodIDFK.Width = TempVars("FoodWidth").Value
Me.cboFoodIDFK.ColumnWidths = ShrinkCombo(Me.cboFoodIDFK.ColumnWidths)
End Sub
Public Function ExpandCombo(pstrWidths As String) As String
Dim strWidth() As String, strNewWidth As String
Dim i As Integer
strWidth() = Split(pstrWidths, ";")
'For i = 0 To UBound(strWidth)
' Debug.Print strWidth(i)
'Next
strWidth(1) = CStr(Val(strWidth(1)) * 1.5)
For i = 0 To UBound(strWidth)
strNewWidth = strNewWidth & strWidth(i) & ";"
'Debug.Print strWidth(i)
Next
'Debug.Print strNewWidth
ExpandCombo = Left(strNewWidth, Len(strNewWidth) - 1)
'Debug.Print "Expanding " & ExpandCombo
'MsgBox ExpandCombo
End Function
Public Function ShrinkCombo(pstrWidths As String) As String
Dim strWidth() As String, strNewWidth As String
Dim i As Integer
strWidth() = Split(pstrWidths, ";")
'For i = 0 To UBound(strWidth)
' Debug.Print strWidth(i)
'Next
strWidth(1) = CStr(Val(strWidth(1)) / 1.5)
For i = 0 To UBound(strWidth)
strNewWidth = strNewWidth & strWidth(i) & ";"
'Debug.Print strWidth(i)
Next
ShrinkCombo = Left(strNewWidth, Len(strNewWidth) - 1)
'Debug.Print "Shrinking " & ShrinkCombo
'MsgBox ShrinkCombo
End Function