gkdada67
07-14-2010, 01:03 AM
Please send me any example for connecting vb6 to excel work sheet , Just I am creating a application for college attendance that is periods wise so I like to use this ms excel 2003 or 2007
Please help me
Flyguy
07-14-2010, 02:27 AM
What have you done so far?
gkdada67
07-15-2010, 02:20 AM
Hello
Just I am creating a application using students period attendance so I like to connect vb6 to excel
Help me….
Colin Legg
07-15-2010, 02:29 AM
Yes, we understand that, but what have you done so far?
gkdada67
07-15-2010, 02:34 AM
Please help me I don’t know well about vb6
Colin Legg
07-15-2010, 02:38 AM
We want to help you, but you are not answering our question: what have you done so far?
gkdada67
07-15-2010, 02:41 AM
I created a vb6 form what I want now that contains number of check box, now I link that check box to excel worksheet, each check box to each Colum
Colin Legg
07-15-2010, 02:43 AM
Okay... your starting point will be to study our Automating Excel from VB 6.0 (http://www.xtremevbtalk.com/showthread.php?t=135815) tutorial. This will begin to give you some ideas about the sort of code required to interact between VB6 and Excel.
Good luck!
gkdada67
07-16-2010, 11:54 PM
hi
I got the code for link vb6 to excel
Now I am using that code but it is creating new file always, so I want to save that data in one file always , please answer me.
Option Explicit
'Add a reference to MS Excel xx.0 Object Library
Private moApp As Excel.Application
Private moWB As Excel.Workbook
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
Check1.Caption = "19"
Check1.Value = "1"
ElseIf Check1.Value = vbUnchecked Then
Check1.Caption = "A"
Check1.Value = "0"
End If
End Sub
Private Sub Form_Load()
Check1.Caption = "A"
Set moApp = New Excel.Application
moApp.Visible = False
End Sub
'Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
' If TypeName(moWB) <> "Nothing" Then
' moWB.Close True, "C:\Hello.xls"
' End If
' Set moWB = Nothing
' If TypeName(moApp) <> "Nothing" Then
' moApp.Quit
' End If
' Set moApp = Nothing
'End Sub
Private Sub Command2_Click()
Set moWB = moApp.Workbooks.Add
moApp.Visible = True
moWB.Sheets("Sheet1").Cells(1, 2).Value = (Check1.Value)
moWB.Sheets("Sheet1").Cells(1, 1).Value = (Text1.Text)
'moWB.Sheets("Sheet1").Cells(1, 1).Value = moWB.Sheets("Sheet2").Cells(1, 1).Value
End Sub
Private Sub Command1_Click()
End
End Sub
Colin Legg
07-20-2010, 10:57 AM
I got the code for link vb6 to excel
Now I am using that code but it is creating new file always, so I want to save that data in one file always , please answer me.
Instead of using the Workbooks.Add method, which creates a new workbook each time, you need to use the Workbooks.Open method, which opens an existing workbook.