Is there any way to transfer Excel code into VB?
Thanx, Mikelo
Printable View
Is there any way to transfer Excel code into VB?
Thanx, Mikelo
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