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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

VB API Set session mismatch error

mtonsager
10-Marble

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, "\")

 

ACCEPTED SOLUTION

Accepted Solutions

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"

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

Announcements


Top Tags