Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I read from an MS Excel file using VB?

Status
Not open for further replies.

mn20

Programmer
Feb 16, 2001
10
SG
i have a list of names in an Excel file and i want it to be read by my VB application. What components/references do i need to use and what are the syntax for openning and reading that Excel file. thanks a lot!
 
Here is how I would start.
Start up Excel. Start recording a macro(tools / macro).
Open the document worksheet you want to read. Save it as a Tab-delimited text file. Close the file. Stop recording the macro. Look at the macro to see all the code needed. There are a number of articles in MSDN about using OLE Automation
Use LATE-BINDING for production.
Code:
#If blnDebug then
    Dim objAPPl as Excel.Application ' Allows Intellisense
    Dim objWrkS as EXCEL.WorkSheet
#else
    Dim objAPPl as object ' Back level Excel will still work
    Dim objWrkS as object
#End if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top