文件名称:Excel VBA_ADO+SQL实例集锦.doc.txt
文件大小:93KB
文件格式:TXT
更新时间:2024-04-02 04:55:12
ExcelVBA vba_ado数据库连接
‘订单生成系统.xls
‘f6-第6列,f2-第2列
Private Sub Worksheet_Activate()
On Error Resume Next
Dim x As Object, yy As Object, sql As String
Set x = CreateObject("ADODB.Connection")
x.Open "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='Excel 8.0;hdr=no;';Data Source=" & ActiveWorkbook.FullName
sql = "select f6,f2,f3,f4,f5,f7,f13,f24 -f25 from [sheet1$] where f24 -f25