VB操作已经打开着的EXCEL
VB操作已经打开着的EXCEL我想在任意打开的EXCEL中插入数值
Private Sub Command1_Click()
Dim i As Long
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then Exit Sub '没有打开
Set xlBook = xlApp.ActiveWorkbook '打开的EXCEL文件
For i = 0 To 10
xlApp.ActiveCell.Offset(i) = i
Next i
xlBook.Save
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
这样的代码
Set xlApp = GetObject(, "Excel.Application")出现错误代码429 求解