Getting excel Sheets

R

Roy Goldhammer

Hello there

I need to import excel into access.

For this i need to know how many sheets are on excel file, and what is the
name of them

Is there a way to get this information?

--
øåòé âåìãäîø
ù.î. òúéã äðãñú úåëðä
(e-mail address removed)
èì: 03-5611606
ôìà' 050-7709399
 
K

Klatuu

You will have to do this using VBA code. Here is what you will need to do:
1. Have a method of knowing the full path and name of the Excel file you
want to open. Here is a link that will be useful for this -
http://www.mvps.org/access/api/api0001.htm

2. Create an Instance of Excel. There is a good example of how do this in
VBA Help under GetObject
3. Open the workbook - This is also covered in the GetObject Help

4. You can then determine the number of sheets using Worksheets.Count
5. Loop through the worksheets and retrieve their names. Here is a sample
routine that shows how this is done.

Dim sht As Worksheet
For Each sht In xlBook.Worksheets
Debug.Print sht.Name
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Merging two Pictures 11
Using Format for textboxes 1
Merging two Tif files to one file 5
Get Data from source safe 4
error 3709 3
Waiting for finish Shell Function 1
Error 1104 1
Terminal service problem 0

Top