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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

VB API Set session mismatch error

mtonsager
5-Regular Member

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
mtonsager
5-Regular Member
(To:mtonsager)

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

View solution in original post

2 REPLIES 2

use

Set cAC As New CCpfcAsyncConnection

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"
mtonsager
5-Regular Member
(To:mtonsager)

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

Top Tags