VBA Run time error '5' in Apprentice Server Component

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
We are trying to run Inventor 2020 VBA scripts from Excel 2013, but got the issue "Run-time error '5': Invalid procedure call or argument" at the line "Set oApprentice = New ApprenticeServerComponent"
in the below copied code.
We are using Excel 2013 64bit and Inventor Professional 2020 64bit. Request your help to resolve this.
Private Function InitInvAPP(oTopDoc As Inventor.AssemblyDocument) As Boolean
Set invApp = ThisApplication
Set oApprentice = New ApprenticeServerComponent
Set eXcelAPP = GetObject(, "excel.application")
If eXcelAPP Is Nothing Then
InitInvAPP = False
Exit Function
End If
On Error Resume Next
Set oTopDoc = invApp.ActiveDocument
If Err.Number <> 0 Then
InitInvAPP = False
Exit Function
End If
If oTopDoc Is Nothing Then
InitInvAPP = False
Else
InitInvAPP = True
End If
End Function