Solved

VB6 - Copy all cells from a specific row to clipboard.

Posted on 2014-10-01
8
134 Views
Last Modified: 2014-10-01
Hi

I would like to know how i can copy to clipboard all cells from a selected row in my MSHFlexgrid1, and when i will paste this in excel, all MSHFlexgrid cells will go in different cells in excel.

Is that possible?

Thanks again for your help.
0
Comment
Question by:Wilder1626
  • 5
  • 3
8 Comments
 
LVL 11

Author Comment

by:Wilder1626
ID: 40355632
I think i have it.

something like this would do it:
    Dim str As String, i As Integer
    With MSHFlexGrid1
        For i = 0 To .Cols - 1
            str = str & .TextMatrix(1, i) & vbTab
        Next i
        Clipboard.SetText (str)
    End With

Open in new window

0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40355642
Try this. Before you do set the grid's SelectionMode to flexSelectionByRow ( or 1)

    Clipboard.Clear
    Clipboard.SetText MSHFlexGrid1.Clip
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40355645
That of course is just the copying part. In order to do the rest i need to know where this is being done? Is the code in a VB6 project and you want to update a sheet in an existing workbook?
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40355650
The copy to Excel could be as simple as this.

    Range("A1").Select
    ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 11

Author Comment

by:Wilder1626
ID: 40355951
Yes, this all start in my MSHFlexgrid. That is were i will do the copy thing.

Once i click in the row, it will copy all the cells to clipboard.

Then, i would go in Excel and just paste the values.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40355993
That's what my two code snippets do.
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 40356004
Thanks again for your help. This is perfect
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40356019
You're welcome.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
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…
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…
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…

757 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

21 Experts available now in Live!

Get 1:1 Help Now