请教个VB如何保存EXCEL的问题
我用VB做了一个上位机,将数据保存到EXCEL中~现在我EXCEL自动保存的程序如下:
Private Sub Command4_Click()
Timer2.Enabled = True
j = j + 1
x1sheet.Cells(j + 1, 4) = temp1_show.Text
x1sheet.Cells(j + 1, 3) = Time$
x1sheet.Cells(j + 1, 5) = temp2_show.Text
x1sheet.Cells(j + 1, 6) = temp3_show.Text
x1sheet.Cells(j + 1, 7) = temp4_show.Text
x1sheet.Cells(j + 1, 8) = temp5_show.Text
x1sheet.Cells(j + 1, 9) = temp6_show.Text
x1sheet.Cells(j + 1, 1) = Format(Date, "Long Date")
x1book.save
End Sub
就是每隔一段时间将EXCEL保存起来,但是我这个程序是自动保存到我的文档里的~请问我怎么修改可以将它保存到指定的位置,并且不会出现每次保存的时候都会出现是否覆盖原有文档的提示!
[解决办法]
Private Sub Command4_Click()
Timer2.Enabled = True
j = j + 1
x1sheet.Cells(j + 1, 4) = temp1_show.Text
x1sheet.Cells(j + 1, 3) = Time$
x1sheet.Cells(j + 1, 5) = temp2_show.Text
x1sheet.Cells(j + 1, 6) = temp3_show.Text
x1sheet.Cells(j + 1, 7) = temp4_show.Text
x1sheet.Cells(j + 1, 8) = temp5_show.Text
x1sheet.Cells(j + 1, 9) = temp6_show.Text
x1sheet.Cells(j + 1, 1) = Format(Date, "Long Date")
xlapp.DisplayAlerts = False '不出现警告信息
x1book.SaveCopyAs "d:\test.xls" '另存XLBOOK为test.xls,并且不关闭XLBOOK
xlapp.DisplayAlerts = True
End Sub