Solved

Transfer data from mshgrid in Vb6.0 to excel

Posted on 2004-08-16
2
406 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
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…

733 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