怎么把vb的text中的内容输入到excel单元格中?
2个回答
展开全部
Private Sub Command1_Click()
Set objexcel = CreateObject("Excel.application")
objexcel.DisplayAlerts = False
Set objworkBook = objexcel.Workbooks.Open("d:\book1.xls")
objexcel.activecell.Value = text1 '保存到当前单元格
'objworkBook.activesheet.cells(r, c).Value = text1 '保存到指定单元格用这句,需要指定r和c即第几行和第几列
objworkBook.Save
objworkBook.Close
objexcel.quit
Set objexcel = Nothing
End Sub
Set objexcel = CreateObject("Excel.application")
objexcel.DisplayAlerts = False
Set objworkBook = objexcel.Workbooks.Open("d:\book1.xls")
objexcel.activecell.Value = text1 '保存到当前单元格
'objworkBook.activesheet.cells(r, c).Value = text1 '保存到指定单元格用这句,需要指定r和c即第几行和第几列
objworkBook.Save
objworkBook.Close
objexcel.quit
Set objexcel = Nothing
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询