cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

VB API Set session mismatch error

SOLVED
Participant

VB API Set session mismatch error

Trying to launch Creo with Excel based macro, when it gets to the Set session=asyncConnection.session command, I receive a Run-time error '13': Type mismatch.  Pasted below, any help on why I am getting this error is appreciated

 

Sub CreoTest()
'
' CreoTest Macro
'

'

Dim asyncConnection As IpfcAsyncConnection
Dim cAC As New CCpfcAsyncConnection
Dim session As IpfcBaseSession
Dim descModel As IpfcModelDescriptor
Dim descModelCreate As CCpfcModelDescriptor
Dim model As IpfcModel
Dim workDir As String
Dim position As Integer
' On Error GoTo RunError
'======================================================================
'First Argument : The path to the Pro/E executable along with command
'line options. -i and -g flags make Pro/ENGINEER run in non-graphic,
'non-interactive mode
'Second Argument: String path to menu and message files.
'======================================================================
Set cAC = New CCpfcAsyncConnection
' Set asyncConnection = cAC.Connect(Null, Null, ".", 5)
Set asyncConnection = cAC.Start("C:\PTC\Creo 2.0\Parametric\bin\parametric.exe", ".")
' + " -g:no_graphics -i:rpc_input", ".")
Set session = asyncConnection.session
'======================================================================
'Get current directory
'Set it as working directory
'======================================================================
workDir = ActiveWorkbook.FullName
position = InStrRev(workDir, "\")

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: VB API Set session mismatch error

Figured it out, needed to add pfcls. in my Dim commands

View solution in original post

2 REPLIES 2

Re: VB API Set session mismatch error

use

Set cAC As New CCpfcAsyncConnection

Re: VB API Set session mismatch error

Figured it out, needed to add pfcls. in my Dim commands

View solution in original post