Solved

MSHflexgrid and copying contents to the clipboard

Posted on 2001-08-14
3
230 Views
Last Modified: 2010-05-18
This may be a simplistic question, and it may be answered already, but I can't seem to get the search results to come up with any results.

I need a quick and easy way to copy the user selected portion of a MSHflexgrid to the clipboard.

Any takers?
0
Comment
Question by:edwinson
[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
3 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6386142
Something like this:

        With mshfgMB
            'Select all data
            .Row = 0
            .Col = 0
            .RowSel = .Rows - 1
            .ColSel = .Cols - 1
            Clipboard.SetText .Clip
        End With
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 6387231
Private Sub grdTrends_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = vbRightButton Then
        If MsgBox("Copy Selected Cells To Clipboard?", vbExclamation + vbYesNo) = vbYes Then
            With grdTrends
                If .Col <= .ColSel Then
                    intColStart = .Col
                    intColEnd = .ColSel
                Else
                    intColStart = .ColSel
                    intColEnd = .Col
                End If
                If .Row <= .RowSel Then
                    intRowStart = .Row
                    intRowEnd = .RowSel
                Else
                    intRowStart = .RowSel
                    intRowEnd = .Row
                End If
                strText = ""
                For intRow = intRowStart To intRowEnd
                    For intcol = intColStart To intColEnd
                        strText = strText & .TextMatrix(intRow, intcol) & IIf(intcol < intColEnd, vbTab, vbCrLf)
                    Next
                Next
                Clipboard.Clear
                Clipboard.SetText strText
            End With
        End If
    End If
End Sub
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6396883
Any news edwinson?
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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 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