第1个回答 2011-08-16
'首先要将“工程-引用”中的Mic… Excel…选中
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
Set xlApp = CreateObject("Excel.Application")
On Error Resume Next
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open(App.Path & "\1.xls")
k = 5
Do While xlApp.Worksheets("Sheet1").Range("A1").Cells(k, 2) <> ""
xlApp.Worksheets("Sheet1").Range("A1").Cells(k, 3) = Format(Now, "yyyy-mm-dd")
xlApp.Worksheets("Sheet1").Range("A1").Cells(k, 4) = Format(Time, "hh:mm")
xlApp.Worksheets("Sheet1").Range("A1").Cells(k, 11) = Format(Now, "yyyy-mm-dd")
xlApp.Worksheets("Sheet1").Range("A1").Cells(k, 12) = Format(Time, "hh:mm")
k = k + 1
Loop
path1 = "C:\Documents and Settings\Administrator\桌面\"
name1 = Format(Now, "yyyymmddhhmmss") & ".xls"
ActiveWorkbook.SaveAs FileName:=path1 & name1
ActiveWorkbook.Close
xlBook.Close (True)
xlApp.Quit
Set xlApp = Nothing
End Sub
第3个回答 2011-08-15
I think you can just use file copy, it doesn't matter excel or not, then add date time for the new excel.
追问如果能够copy,我还问么,晕死,我打开源excel数据就会立刻更新为现在的数据,我要的是以前的数据,明白,,,!
追答if it has macro to update the data, then disable it.
追问不行,我要一直用那个数据的,要一直更新,保存,,,,,每隔1个 小时保存一次