部分代码:
Dim wb As Workbook
rs.Open "select * from productorder
", conn
Set wb = Application.Workbooks.Add
With wb.Sheets(1)
Range("a1:b1:c1:d1:e1:f1") = Array("订单编号", "用户编号", "产品编号", "购买金额", "预期收益", "购买时间")
.Range("A2").CopyFromRecordset rs
Columns("a:e").AutoFit '根据内容调整列宽
End With
wb.SaveAs filePath
这样最后那个字段在mysql数据库是datatime类型,通过vba写入会从2017-08-09 10:54:44变成42956.4546759259,请问怎么改呢?改成年月日就行了,不用后面的时分秒