Results 1 to 2 of 2

Thread: Anyway to transfer Excel Stuff to VB?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    137
    Is there any way to transfer Excel code into VB?
    Thanx, Mikelo

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    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
  •  



Click Here to Expand Forum to Full Width