g*****w 发帖数: 1413 | 1 都要疯了,被这个VBA Macro搞的. 从Excel VBA打开另外一个Excel文件,在某些机器
上Run好好的,在一些机器上就是死活打不开。试了无数种办法, research无数网页,
都折腾了好多天了,就是不work。请大家帮帮,让我有个好周末吧。谢谢大家!
机器是 windows XP, MS Office Excel 2007, .NET framework 3.0. 以下是VBA code
和Error message。
Sub openExcelFile()
Dim oXL As Object, oExcel As Object
Set oXL = CreateObject("Excel.Application")
On Error Resume Next
oXL.UserControl = True
On Error GoTo 0
On Error GoTo ErrHandle
With oXL
.Visible = False
.DisplayAlerts = False
.Workbooks.Open ("C:\temp\test.xlsx")
End With
oXL.Quit
Set oXL = Nothing
Exit Sub
ErrHandle:
MsgBox Err.Description 'error popups here
oXL.Quit
End Sub
Error Message:
Automation Error
The server throw an exception
Run-time error '-2147023170(800706be)'
Automation Error
The remote procedure call failed
|
|