CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012

    How to extract on screen data.


    I have this VB 6 application with about 400 records, it takes forever to extract to an excell sheet.
    Is ther an easy way to get everything into a string or directly into excell? (Maybe clipboard and then Past it.)
    I have Visual Basic Express installed.

    Name:  temp.JPG
Views: 124
Size:  83.7 KB

    Thank you

  2. #2
    Join Date
    May 2002

    Re: How to extract on screen data.


    I'm not sure if this applies. Just load the data into an array and copy to a range in excel

    Imports Microsoft.Office.Interop
    Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim xlApp As Excel.Application
            Dim ws As Excel.Worksheet
            Dim wb As Excel.Workbook
            Dim data(20, 20) As Double
            Dim j, k As Integer
                xlApp = New Excel.Application
                xlApp.UserControl = True 'False
                xlApp.Visible = True 'False
                wb = xlApp.ActiveWorkbook
                ws = wb.Worksheets(1)
                For j = 0 To 20
                    For k = 0 To 20
                        data(j, k) = j * k
                    Next k
                Next j
                ws.Range("A1").Resize(20, 20).Value = data
            Catch ex As Exception
            End Try
        End Sub
    End Class

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.