Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I would like to be able to send data to cells on an excel worksheet using a small VB6 program i've created just like you would with ms access. could someone please pass me some few lines? [Plus connection codes].

Selection.Copy
Range("B1").Select
ActiveSheet.Pastethats a simple way of copying data from one cell to another. is this what you meant as the explanation was a bit lacking :P

Visual Basic (VB6) is a standalone programming language. With some programming effort you can open such things as external Excel spreadsheets.
Viusal Basic for Applications (VBA) at its core is very similar to Visual Basic. Each MS Office application has VBA built into it. Each Office application also has additional VBA functions that are unique to that application.
DaveyB's code might work if Jaymann was really talking about VBA but not VB6. If Jaymann was talking about VB6 then it will take a lot more code to link the VB6 to an Excel spreadsheet.
To enable VB6 to work with the Excel application:
Select "Project"
Select "References..."
Check "Microsoft Excel 8.0 Object Library"Example VB6 code to open an Excel spreadsheet:
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Open("G:\working\myexcel\Mybook.xls")
xlApp.Visible = True

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |