Loomah,
You can get the sheet names with this function
Example Call
IfSheetExists("c:\myTest\Testfile_1.xls","Sheet1")
can be called from VBA or a worksheet
Function IfSheetExists(fName As String, sh As String) As Boolean
Dim objConn As Object
Dim objCat As Object
Dim tbl As Object
Dim iRow As Long
Dim sConnString As String
Dim sTableName As String
Dim cLength As Integer
Dim iTestPos As Integer
Dim iStartpos As Integer
IfSheetExists = False
With ActiveSheet
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & fName & ";" & _
"Extended Properties=Excel 8.0;"
Set objConn = CreateObject("ADODB.Connection")
objConn.Open sConnString
Set objCat = CreateObject("ADOX.Catalog")
Set objCat.ActiveConnection = objConn
iRow = 1
For Each tbl In objCat.Tables
sTableName = tbl.Name
cLength = Len(sTableName)
iTestPos = 0
iStartpos = 1
'Worksheet name with embedded spaces are enclosed by single
quotes
If Left(sTableName, 1) = "'" And Right(sTableName, 1) = "'" Then
iTestPos = 1
iStartpos = 2
End If
'Worksheet names always end in the "$" character
If Mid$(sTableName, cLength - iTestPos, 1) = "$" Then
If sh = Mid$(sTableName, iStartpos, cLength - (iStartpos +
iTestPos)) Then
IfSheetExists = True
Exit For
End If
End If
Next tbl
End With
objConn.Close
Set objCat = Nothing
Set objConn = Nothing
End Function
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)