?
Solved

Transfer data from mshgrid in Vb6.0 to excel

Posted on 2004-08-16
2
Medium Priority
?
419 Views
Last Modified: 2008-01-09
Can some tell me (give the code to transfer data from mshgrid to excel file).

Thank you.
0
Comment
Question by:Aiysha
[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 Comments
 
LVL 5

Expert Comment

by:LordRipper
ID: 11810608
Hi Aiysha,
I found this webpage whith the code on but I cant seem to understand the language but I can make out the code
here is the link
http://66.102.9.104/search?q=cache:ocoART8XAYkJ:www.fesppr.br/~lecheta/Visual%2520Basic/Apostilas/dicasVB%25206.doc+vb6+mshgrid+to+excel&hl=en
Cheers!
0
 
LVL 5

Accepted Solution

by:
Z03niE earned 2000 total points
ID: 11827211
First of all make sure you add Excell Object Library into you project reference.And here's the code

'First off declare some variables
Private objExcel As Excel.Application
Private objWorkbook As Excel.Workbook

private sub Flex2Excel()
   Dim I, N As Integer
   Set objExcel = CreateObject("Excel.Application")
   Set objWorkbook = objExcel.Workbooks.Add

   For I = 0 To MSFlexGrid1.rows - 1             'Filling all the Flexgrid content to the excel worksheet
    For N = 0 To MSFlexGrid1.Cols                 'is the number of the Flexgrid's column
        objWorkbook.ActiveSheet.Cells(I + 1, N + 1).Value = MSFlexGrid1.TextMatrix(I, N)    'the part to transfer flexgrid value to Excel
    Next N
   Next I
objExcel.Visible = True                                 'Show the Excel that contain the result ,comment it if you want to save the Excell without showing it
'    objWorkbook.SaveAs "c:\Flex2Excel.xls"       ' uncomment this part if you want to save the file

'Clean everything up
Set objWorkbook = Nothing
Set objExcel = Nothing
end sub
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

770 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