Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-10-01
8
Medium Priority
?
170 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
[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
  • 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 49

Accepted Solution

by:
Martin Liss earned 2000 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 49

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

 
LVL 49

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

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 49

Expert Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

705 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