Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Warner Robins GA
    Posts
    1

    Thumbs up Unanswered: Get Excel Worksheet Name From VB6

    I need to get the Excel worksheet name using VB6 to enable me to import the spreadsheet into an Access DB without having the worksheet name hardcoded in the VB program. Can anyone tell me how to do this?
    Many thanks for any help.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Get Excel Worksheet Name From VB6

    Yes by automating Excel. Add the Excel Library refrence to your project then write the foloowing code:

    Dim exlApp As Excel.Application

    MsgBox "Please choose a file to Import from the following screen.", vbOKOnly + vbInformation

    Set exlApp = New Excel.Application
    exlApp.FindFile 'Opens the dialog to select File

    Msgbox exlApp.Worksheets(0).Name
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •