0

Help me! I just can't seem to get this right. I'm trying to open an Excel file(Template) and put data from msflexgrid into a specific place in the excel file but i just can't seem to get it right. Can anyone help me with this coding? Much appreciated. Thank you in advance.

P/S: The "for" loops below are correct.

```
Private Sub cmdEXCEL_Click()
On Error Resume Next
Dim exc As Object
Dim objworkbook As Object
Dim i, n As Integer
Open App.Path & " " For Output As exc
Set exc = OpenObject("Excel.Application")
For i = 1 To 1
MSFlexGrid1.Col = i
For n = 0 To MSFlexGrid1.Row
MSFlexGrid1.Col = n
objworkbook.activesheet.cells(n + 15, i + 2).value = MSFlexGrid1.Text
Next
Next
For i = 2 To 6
MSFlexGrid1.Col = i
For n = 0 To MSFlexGrid1.Row
MSFlexGrid1.Col = n
objworkbook.activesheet.cells(n + 15, i + 15).value = MSFlexGrid1.Text
Next
Next
exc.Visible = True
Set exc = Nothing
End Sub
```