|
删除F、G列:
- Private Sub CommandButton3_Click()
- Dim fileSaveName, cnn As Object, SQL$
- fileSaveName = Application.GetSaveAsFilename("结果", fileFilter:="Microsoft Excel Files (*.xlsx),*.xlsx")
- If fileSaveName = False Then Exit Sub
- If Dir(fileSaveName) <> "" Then Kill fileSaveName
- Set cnn = CreateObject("ADODB.Connection")
- cnn.Open "Provider=Microsoft.ace.OLEDB.12.0;Extended Properties=Excel 12.0;Data Source=" & ThisWorkbook.FullName
- SQL = "select 客户,日期,单号,省份,重量,金额,备注 into [Excel 12.0 xml;Database=" & fileSaveName & "].Sheet1 from [sheet1$A10:I]"
- cnn.Execute SQL
- cnn.Close
- Set cnn = Nothing
- End Sub
复制代码 |
|