954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Linking MS Excel to MS Visual Basic 6.0

I prepared a simple database in ms excel. Now I want to link it with ms visual basic 6.0. I want to enter data in ms visual basic form and it will update my excel database/ spreadsheet. How to link a record in ms excel with visual basic 6.0 ? And How to enter data on visual basic from?

Plz help me, ...anyone


Regards
S.N.Mazumder Amit

S.N.Mazumder
Newbie Poster
5 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

Okay, there is more than one way in which to use excel with visual basic 6.0. Now, you said as a database so you will need to use your friends (yahoo, google, ask, answers, bing) and search for vb6 ado tutorial. Then see http://www.connectionstrings.com for a DNS LESS connection string that you will need for your ADO connection.

Also, you could use your friends to search for vb6 automating excel tutorial...

Good Luck

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

How to link or connect MS Access 2003 database with MS Visual Basic 6.0 for creating salary sheet?

Please anyone help me in datails. Or suggest me, Which verson of visual basic I can use as a beginner in programming side.

From
Amit

S.N.Mazumder
Newbie Poster
5 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

How to link or connect MS Access 2003 database with MS Visual Basic 6.0 for creating salary sheet?

Please anyone help me in datails. Or suggest me, Which verson of visual basic I can use as a beginner in programming side.

From Amit


I can tell you a very simple way. like:
put a data control in your form. go to data control properties. select database name and then select the record source ( table name).
one thing you need service pack 6 (vb) for use office 2003.
you can use visual basic 6

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

I did the work before that you advised. But when I click on record source the following message is shown: unrecognized database format ' E\Salary in Access.mdb'.
I use MS Access 2003 and MS Visual Basic 6.0. Isn't it possible?

Now what problem may arise here? Plz suggest me anyone.

S.N.Mazumder
Newbie Poster
5 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

u need service pack 6 of vb6. download it from Microsoft site.

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

how to connect VB6.0 to MS Excel 2003

venice yu
Newbie Poster
1 post since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

venice yu, please read our posting rules HERE . We do not allow the "theft" of others posts here on Daniweb.:)

Please open your own thread (at the top of the forum page) and we will gladly help you from there.;) I will not post a solution on this post.

AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
 

'Check this out. VB6 interact with Excel

Dim xl As excel.Application
Dim sAmount As String
Private Function getTotalSales()
sAmount = Str(xl.ActiveSheet.Range("SalesTotal").Value)
Label1.Caption = "Total Sales: " & "P " & Trim$(FormatNumber(sAmount))
Text3.Text = Str(xl.ActiveSheet.Range("JanSales").Value)
Text2.Text = Str(xl.ActiveSheet.Range("FebSales").Value)
Text1.Text = Str(xl.ActiveSheet.Range("MarSales").Value)
End Function

Private Sub Command1_Click()
xl.Visible = True
End Sub

Private Sub Command2_Click()
tsentry = Val(txtJan) + Val(txtFeb) + Val(txtMar)
MsgBox ("P" & FormatNumber(tsentry) & " sales added.")

xl.ActiveSheet.Range("JanSales").Value = (xl.ActiveSheet.Range("JanSales").Value) + Val(txtJan.Text)
xl.ActiveSheet.Range("FebSales").Value = (xl.ActiveSheet.Range("FebSales").Value) + Val(txtFeb.Text)
xl.ActiveSheet.Range("MarSales").Value = (xl.ActiveSheet.Range("MarSales").Value) + Val(txtMar.Text)
txtJan.Text = ""
txtFeb.Text = ""
txtMar.Text = ""
getTotalSales

End Sub

Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Command2.Font.Bold = True Then
Command2.Font.Bold = False
Else
Command2.Font.Bold = True
End If
End Sub


Private Sub Command4_Click()
xl.ActiveWorkbook.PrintOut
End Sub


Private Sub Form_Load()
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Open (App.Path & "\Sales.xls")

getTotalSales

End Sub

Private Sub Form_Unload(Cancel As Integer)

xl.ActiveWorkbook.Save
xl.Quit
Set xl = Nothing

End Sub
rexgb_34
Newbie Poster
6 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You