Computing.Net > Forums > Programming > VB Code

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB Code

Reply to Message Icon

Name: Jaymann
Date: March 15, 2004 at 03:24:38 Pacific
OS: Win XP Home
CPU/Ram: 256MB
Comment:

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].



Sponsored Link
Ads by Google

Response Number 1
Name: DaveyB
Date: March 15, 2004 at 12:30:01 Pacific
Reply:

Selection.Copy
Range("B1").Select
ActiveSheet.Paste

thats a simple way of copying data from one cell to another. is this what you meant as the explanation was a bit lacking :P


0

Response Number 2
Name: egkenny
Date: March 17, 2004 at 12:02:50 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB Code

A VB Code for Printed pages counter www.computing.net/answers/programming/a-vb-code-for-printed-pages-counter/12702.html

vb code www.computing.net/answers/programming/vb-code-/10104.html

VB code help www.computing.net/answers/programming/vb-code-help/12893.html