|
-
Oct 11th, 2000, 10:59 AM
#1
Thread Starter
Addicted Member
Is there any way to transfer Excel code into VB?
Thanx, Mikelo
-
Oct 12th, 2000, 11:28 AM
#2
Addicted Member
This is an example I used to answer a similar question some time ago. First, you have to add the reference for Microsoft Excel 8.0 library to your project.
Option Explicit
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
Dim xlWS As Excel.Worksheet
Dim sNames() As String
xlApp.Workbooks.Open "Path and Filename"
Set xlWS = xlApp.ActiveWorkbook.Worksheets.Item(index or name)
sNames = xlWS.Cells(row, column)
' Other processing here
xlApp.Workbooks.Close
xlApp.Quit
Set xlWS = Nothing
Set xlApp = Nothing
End Sub
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
|