Hehe, saw it on MS newsgroup. Although we all know how to use ADO when learning it normally, it's still difficult to recall it in critical moments. Can you think of ADO without using Excel.Application?
Sample code
[ Last edited by electronixtar on 2006-8-27 at 15:41 ]
Sample code
Dim oADO, oRS, sSQL, sConn
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ray\SomeExcelFile.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
sSQL = "SELECT this, that FROM "
Set oADO = CreateObject("ADODB.Connection")
oADO.Open sConn
Set oRS = oADO.Execute(sSQL)
If Not oRS.EOF Then WScript.Echo oRS.GetString(2,,",",vbCRLF,"")
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
[ Last edited by electronixtar on 2006-8-27 at 15:41 ]
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| redtek | +2 | 2006-10-25 01:52 |
C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
