Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Adjusts width of Left Col to fit text and moves second
'col over as needed.
'Values are in twips
'twips = inches * 1440
'inches = twips / 1440
Dim varLeftCol As Variant
Dim varSecondColWidth As Variant
varLeftCol = Me.[red]txtLeftCol[/red]
'Default Width of Col (Value is from Properties window)
varSecondColWidth = [red]2685.024[/red]
'Resize Left Col
Me.[red]txtLeftCol[/red].Width = TextWidth(varLeftCol)
'move Second Col over while keeping same amount of space between
'LeftCol and Second Col -- in my test report, 288 was value of
'space between Left Col and start of Second Col.
Me.[red]txtSecondCol[/red].Left = TextWidth(varLeftCol) + [red]288[/red]
'This next line is only necessary if you want to keep right
'hand side of second col to remain constant rather than having
'second col move over so that it extends beyond its existing
'space on the right
'Example if not used:
'[This is the text] [This is the box ]
'[This is more text than before] [This is the box ]
'[Here less text than before] [This is the box ]
'Example if used:
'[This is the text] [This is the box ]
'[This is more text than before] [This is the box]
'[Here less text than before] [This is the box ]
'If you don't need, then comment out this next line
Me.[red]txtSecondCol[/red].Width = varSecondColWidth - (TextWidth(varLeftCol) - 1440)
End Sub