by Amit (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 15th October 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This spinet will export a MSHGrid data into excel for further analysis
API Declarations
Microsoft Hirearical Grid Data Name : MSH
Public Function Export(FG As MSHFlexGrid, Sname As String)
Static objexc As Object
Static objexcwkb As Excel.Workbook
Static objexcwst As Excel.Worksheet
Dim P As Long
Dim q As Long
Dim newCell As String
Set objexc = CreateObject("Excel.Application")
If Err.Number <> 0 Then
Set objexc = New Excel.Application
Err.Clear
End If
On Error Resume Next
objexc.Visible = False
objexc.DisplayAlerts = False
Set objexcwkb = objexc.Workbooks.Add
Set objexcwst = objexc.ActiveSheet
For P = o To FG.Rows - 1
For q = o To FG.Cols - 1
FG.Row = P
FG.Col = q
newCell = Chr(q + 65) & P + 1
objexcwst.Range(newCell).Value = FG.Text
Next
Next
objexc.Visible = True
objexc.DisplayAlerts = True
Set objexc = Nothing
Set objexcwrk = Nothing
Set objexcwst = Nothing
End Function
Now make a cmdexport command on the form and write following code into the cmdexport command
private sub cmdexport_click()
Export MSH, "Export of Data"
end sub
No comments have been posted about This spinet will export a MSHGrid data into excel for further analysis. Why not be the first to post a comment about This spinet will export a MSHGrid data into excel for further analysis.