VBA Run time error '5' in Apprentice Server Component

VBA Run time error '5' in Apprentice Server Component

Anonymous
Not applicable
310 Views
2 Replies
Message 1 of 3

VBA Run time error '5' in Apprentice Server Component

Anonymous
Not applicable

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

0 Likes
311 Views
2 Replies
Replies (2)
Message 3 of 3

Anonymous
Not applicable

Hi Michael,

 

When I was posting the query, my chrome got closed. So that I've posted the same again. Sorry for the inconvenience.

0 Likes