Solved

MSHflexgrid and copying contents to the clipboard

Posted on 2001-08-14
3
220 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
  • 2
3 Comments
 
LVL 69

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 69

Expert Comment

by:Éric Moreau
ID: 6396883
Any news edwinson?
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now