如何使用vba 将excel指定行的数据导入到sql2008中?
Sub 合并工作簿()
Dim FilesToOpen
Dim x As Integer
On Error GoTo ErrHandler
Application.ScreenUpdating = False
FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")
If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If
x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open Filename:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x 1
Wend
ExitHandler:
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub
如何在Excel中用vba将word中的表格(一页一张表格...
你在EXCEL中增加一个列名为ID,后在VBA中写以e79fa5e98193e58685e5aeb931333262373364下代码,并引用Microsoft ActiveX Data Objects 2.8后执行
Public Sub 写入SQL2008()
Dim cnn As New ADODB.Connection
Dim SQL As String, mydata As String, mytable As String
Dim i%
mydata = "KKKK" '指定要修改的数据库
mytable = "aaaa" '指定数据表
'建立与指定SQL Server数据库的连接
cnn.ConnectionString = "Provider=SQLOLEDB;" _