|
-
Jun 27th, 2002, 09:22 AM
#1
Thread Starter
Addicted Member
Can an Excel spreadsheet by accessed by VB6?
This whole question is probably stupid but:
Can an Excel spreadsheet by accessed by VB6?
I mean without using Shell and Sendkeys. This is stupid but - "SAY" ...... String = (C:\myspreadsheet.xls.Cells(1,1).value)
If true - can 255 access an Excel spreadsheet at once like a data-base (for read only)?
Just curious.... I know nothing about databases and VB6... I'm really only trying to do something that seems simple (my other question in the db forum):
------------------------------------------------------------------------
I've never played with VB6 and database files.... I've been browsing through the tutorials by Karl, but I'm missing specifically what I'm looking for.
Basically, I have an Access97 database at work with 5 tables.
I just need to be able to "read" and search the information. Really, just like you would use an array....
I want to access one table at a time and load all the column 1 cells in to listboxs. Then, if the data in the listbox is selected, I want to search through the table until the "data" is found and then read different cells in that row/record depending on what's going on (completly transparent to the user).
This is for a stand alone VB6 app, but (as an example) if it was for an Excel VB Script I would be doing something like:
VB Code:
Sub_LoadListBox_click()
LastCol = Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
For X = 2 to LastCol
MyListbox.additem Cells(X,1).value
Next X
End Sub
'----------------------------------------
Sub Button_click()
For X = 0 To MyListbox.ListCount - 1
If MyListbox.Selected(X) = True Then TempStr = OfficListBox.List(X)
Next X
Worksheets("MyWorksheet").activate
LastCol = Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
TempNumber = 0
For X = 2 to LastCol
If Cells(X,1) = TempStr Then
TempNumber = X
Exit For
End If
Next X
If TempNumber = 0 Then Exit Sub
MyNameStr = Cells(X,1).value
MyNumberStr = Cells(X,2).value
MyAddressStr = Cells(X,3).Value
'(blah blah)
End Sub
Thanks for any help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|