1,217
社区成员




Private Sub Command1_Click()
Dim xlapp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Set xlapp = CreateObject("Excel.Application")
Set xlbook = xlapp.Workbooks.Add
Set xlsheet = xlbook.Worksheets(1)
With Adodc1.Recordset
xlsheet.Range("a1").CopyFromRecordset Adodc1.Recordset
xlapp.Visible = True
xlsheet.Columns("a:d").AutoFit
xlsheet.Range("Z1").FormulaR1C1 = "1"
xlsheet.Range("Z1").Copy
xlsheet.Columns("D").PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, SkipBlanks:=False, Transpose:=False
xlsheet.Range("Z1").FormulaR1C1 = ""
xlsheet.SaveAs App.Path & "\test.xls"
xlapp.Workbooks.Close
Set xlapp = Nothing
End With
End Sub