Solved

Trouble setting width of MSflexigrid

Posted on 2013-11-26
4
183 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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Modifying Conditional Format from VBA code 3 69
Protecting vb6 & .Net code Obfuscation 18 181
Sub or Function is not defined 6 51
backup program with robocopy 6 69
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

713 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