VB中如何把text中的内容写入指定的Excel中
VB中如何把text中的内容写入指定的Excel中,比如我要把1,2,3,4,5,6分别写入指定格式Excel中的A16,B16,C16,D16,E16,F16中,该如何...
VB中如何把text中的内容写入指定的Excel中,比如我要把1,2,3,4,5,6分别写入指定格式Excel中的A16,B16,C16,D16,E16,F16中,该如何操作,请高手指教
展开
展开全部
应该把命令写在:在TEXT1推动焦点时,进行该命令:
Dim app As Excel.Application
Dim wbk As Excel.Workbook
Dim wsh As Excel.Worksheet
Private Sub Text1_LostFocus()
Set app = CreateObject("excel.Application")
Set wbk = app.Workbooks.Open(Path)
Set wsh = app.Worksheets(1)
wsh.Activate
wsh.Cells(a, b) = Text1.Text
wbk.Close
app.Quit
Set app = Nothing
Set wbk = Nothing
Set wsh = Nothing
End Sub
Dim app As Excel.Application
Dim wbk As Excel.Workbook
Dim wsh As Excel.Worksheet
Private Sub Text1_LostFocus()
Set app = CreateObject("excel.Application")
Set wbk = app.Workbooks.Open(Path)
Set wsh = app.Worksheets(1)
wsh.Activate
wsh.Cells(a, b) = Text1.Text
wbk.Close
app.Quit
Set app = Nothing
Set wbk = Nothing
Set wsh = Nothing
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询