Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/10/2006, 10:13
data_uy
 
Fecha de Ingreso: junio-2006
Mensajes: 5
Antigüedad: 18 años, 6 meses
Puntos: 0
Proba con esto:

Public Sub AjustaColumnas(Rejilla As MSFlexGrid)
Dim oldFont As StdFont, oldScale As Integer
Dim AnchoText As Single, AnchoMax As Single
Dim c As Integer, r As Long

With Rejilla
Set oldFont = .Parent.Font
Set .Parent.Font = .Font
oldScale = .Parent.ScaleMode
.Parent.ScaleMode = vbTwips
For c = 0 To .Cols - 1
AnchoMax = .Parent.TextWidth(.TextMatrix(0, c)) + 256
For r = 0 To .Rows - 1
AnchoText = .Parent.TextWidth(.TextMatrix(r, c)) + 256
If AnchoText > AnchoMax Then AnchoMax = AnchoText
Next r
.ColWidth(c) = AnchoMax
Next c
Set .Parent.Font = oldFont
.Parent.ScaleMode = oldScale
.Row = 0
End With
End Sub