Solved

MSHflexgrid and copying contents to the clipboard

Posted on 2001-08-14
3
231 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

691 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