vb编程能否实现打开excle调入数据,修改数据后再保存时能保存到原excle中?? 5
1个回答
展开全部
以下代码打开e:\1.xls,然后把A13单元格内容改为“你好!”后保存退出:
Private Sub Command1_Click()
Dim oxl As Object, owb As Object, ost As Object
Set oxl = CreateObject("Excel.Application")
Set owb = oxl.Workbooks.Open("e:\1.xls")
Set ost = owb.ActiveSheet
ost.cells(13, 1) = "你好!"
owb.save
owb.Close
oxl.quit
Set ost = Nothing
Set owb = Nothing
Set oxl = Nothing
End Sub
Private Sub Command1_Click()
Dim oxl As Object, owb As Object, ost As Object
Set oxl = CreateObject("Excel.Application")
Set owb = oxl.Workbooks.Open("e:\1.xls")
Set ost = owb.ActiveSheet
ost.cells(13, 1) = "你好!"
owb.save
owb.Close
oxl.quit
Set ost = Nothing
Set owb = Nothing
Set oxl = Nothing
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询