Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub ListFieldADO()
- strFile = Workbooks(1).FullName
- strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile _
- & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"
- Set cn = CreateObject("ADODB.Connection")
- cn.Open strCon
- ''You can also use the name of a named range
- Set rs = cn.OpenSchema(adSchemaColumns, _
- Array(Empty, Empty, "Sheet1$"))
- While Not rs.EOF
- Debug.Print " " & rs!Column_Name
- rs.MoveNext
- Wend
- rs.Close
- Set rs = Nothing
- End Sub
- Select Top 1 * from [SheetName$]
- SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = [YourTableName]
Add Comment
Please, Sign In to add comment