[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

Trouble setting width of MSflexigrid

This code only displays part of the last column, it's not wide enough
Sub SetGridWidth()
    Dim i As Integer
    Dim iWidth As Long
    Dim LineWidth As Integer
    LineWidth = 20
    
    For i = 0 To gridStats.Cols - 1
    With gridStats
    iWidth = iWidth + .ColWidth(i) + LineWidth
    End With
    Next i
    gridStats.Width = iWidth

Open in new window


Whats wrong ?
0
isnoend2001
Asked:
isnoend2001
  • 2
  • 2
2 Solutions
 
ChloesDadCommented:
The width of your columns are given in twips, however the width of the control will be in the units as defined by form.scalemode.

Also, it wont work if the font is different in each cell
0
 
isnoend2001Author Commented:
Thanks
All the fonts are the same, how do i write it
0
 
ChloesDadCommented:
You can set it at runtime by using

Form1.ScaleMode = vbtwips
0
 
isnoend2001Author Commented:
Thanks I have changed the line width to 38 and will leave it at that, it's close enough
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now