This Domain Is For Sell, Contact:
Apr 082010


Sub test()
    Dim cn As Object, cat As Object, tbl As Object, str$
    Set cn = CreateObject("ADODB.Connection")
    Set cat = CreateObject("ADOX.Catalog")
    Set tbl = CreateObject("ADOX.Table")
    cn.Open "dsn=excel files;dbq=" & ThisWorkbook.Path & "/test.xls"
    cat.ActiveConnection = cn
    For Each tbl In cat.Tables
        str = str & Replace(tbl.Name, "$", "") & vbCrLf
    MsgBox str
    Set cn = Nothing
    Set cat = Nothing
    Set tbl = Nothing
End Sub

Notice: The names are arrayed in alphabetical order, but not from beginning to end in the workbook.


● Use Microsoft Office 2007 like a Pro!
● Excel Expert User-Your One Stop Solution In Mastering Microsoft Excel
● 101 Secrets of a Microsoft Excel Addict
● Excel VBA Made Easy
● Doc2Txt
● Create Your Own Programming Language

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>