Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Trouble setting width of MSflexigrid

Posted on 2013-11-26
4
Medium Priority
?
194 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 2000 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Suggested Courses

618 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