Solved

Trouble setting width of MSflexigrid

Posted on 2013-11-26
4
184 Views
Last Modified: 2013-11-26
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
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Assisted Solution

by:ChloesDad
ChloesDad earned 500 total points
ID: 39678725
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
 

Author Comment

by:isnoend2001
ID: 39678745
Thanks
All the fonts are the same, how do i write it
0
 
LVL 15

Accepted Solution

by:
ChloesDad earned 500 total points
ID: 39678785
You can set it at runtime by using

Form1.ScaleMode = vbtwips
0
 

Author Closing Comment

by:isnoend2001
ID: 39678925
Thanks I have changed the line width to 38 and will leave it at that, it's close enough
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question