Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > how to link vb with excel


Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2003, 12:11 AM
Qopo Qopo is offline
Newcomer
 
Join Date: Apr 2003
Posts: 5
Exclamation how to link vb with excel


hi ppl, I have been stuck by this problems for a fews weeks, I have problem linking vb6 and excel and drawing data from excel.

my code
...........
Dim wbBook As Workbook
Dim sconn As String
Dim wsSheet1 As Worksheet
Dim sfile As String
sfile = App.Path & "\" & "T2C12.xls"
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim rnData As Range, rnCell As Range, rnTarget As Range
rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.LockType = adLockBatchOptimistic
sconn = "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" & sfile
rs.Open "SELECT * FROM [sheet1$]", sconn

Set wbBook = rs

With wbBook
Set wsSheet1 = .Worksheets("Column Load-Taking")
End With


With wsSheet1
Set rnData = .Range(.Range("A4"), .Range("A65536").End(xlUp))
End With

$$$$$$$$$$$$$$$
my excel sheet also look very strange cos i dun have fields names

A B C D

1 this is a example of a load taking

2

3 floor area height

4

5 1 2 3

6

4

how do i get the data ? For example i want to get all the values under floor
i have try using rs.fields("floor") but cannot be done
can someone pls tell me.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing data from excel to SQL server using VB jollyguy4all Database and Reporting 3 03-26-2003 05:07 AM
EXCEL and VB Beethoven Word, PowerPoint, Outlook, and Other Office Products 23 11-20-2002 11:37 PM
VB - excel automation slow :o( NicoleM Word, PowerPoint, Outlook, and Other Office Products 5 11-01-2002 06:17 AM
VB link to Excel and back to VB ELV Word, PowerPoint, Outlook, and Other Office Products 36 08-22-2002 05:11 PM
QB to VB Conversion - By AIO BillSoo Tutors' Corner 0 08-06-2002 11:37 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->