Connecting Tech Pros Worldwide Help | Site Map

MS Excel ---> <----Visual BAsic Pl Help!!!!!

Newbie
 
Join Date: Jan 2007
Posts: 3
#1: Jan 15 '07
I want to make a program in visual basic. When i put my salary data in VB (like: Time In , Time Out, DAte, DAy) VB automatically (in the back ground) input this data in the Excel and Show out puts of excel back in Visual Basic (Hours left , Total Hours and Total sALARY). How to do it. My project summary is I want VB to work like a dummy that saves and puts my inputs in Excel and then shows me back the result calculations in excel and finally save that excel file. Please help me and guide. Tell me how to do this. If there are any tutorial that i can modify . Please help. I have no experience in VB. But if u can help me and guide me in right direction.
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#2: Jan 16 '07

re: MS Excel ---> <----Visual BAsic Pl Help!!!!!


Quote:

Originally Posted by bilalbajwa2336

I want to make a program in visual basic. When i put my salary data in VB (like: Time In , Time Out, DAte, DAy) VB automatically (in the back ground) input this data in the Excel and Show out puts of excel back in Visual Basic (Hours left , Total Hours and Total sALARY). How to do it. My project summary is I want VB to work like a dummy that saves and puts my inputs in Excel and then shows me back the result calculations in excel and finally save that excel file. Please help me and guide. Tell me how to do this. If there are any tutorial that i can modify . Please help. I have no experience in VB. But if u can help me and guide me in right direction.

Wouldn't it be better to keep it simple and just use Excel?
Newbie
 
Join Date: Jan 2007
Posts: 3
#3: Jan 16 '07

re: MS Excel ---> <----Visual BAsic Pl Help!!!!!


The thing is when you are working on smart devices. Their small lcd put alot of difficulty for you to put the data in it.
But the purpose of asking for help for this project is alot greater than this. That would a good reference project for me in future. If you wana help then most welcome.
Newbie
 
Join Date: Jan 2007
Posts: 9
#4: Jan 16 '07

re: MS Excel ---> <----Visual BAsic Pl Help!!!!!


hai,
you can do this by using ado connection which establish aconnection between vb and excel. below i have given excel connection string . so using you insert and reterive data as like you access database.

code

Public Function pblfnOpenExcelRecordset(ByVal sFile As String, ByVal strQuery As String) As ADODB.Recordset

On Error GoTo ErrorHandler

Dim rsExcel As ADODB.Recordset
Dim sconn As String
Set rsExcel = New ADODB.Recordset

With rsExcel
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
End With

sconn = "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" & sFile & "; ReadOnly=False;"
rsExcel.Open strQuery, sconn

Set rsExcel.ActiveConnection = Nothing
Set pblfnOpenExcelRecordset = rsExcel

Exit Function
ErrorHandler:
Debug.Print Err.Description + " " + _
Err.Source, vbCritical, "Import"
Err.Clear
End Function

code
Newbie
 
Join Date: Jan 2007
Posts: 3
#5: Jan 18 '07

re: MS Excel ---> <----Visual BAsic Pl Help!!!!!


http://docs.google.com/View?docid=dctgg53g_22hpd27q

I basically want this thing to pop up as visual basic program which may connect with Excel.
Reply