VBA Excel - ImportNewModel
Hi,
I'm working on an Excel VBA tool that imports a lot of pvz files into Creo and saves them as .asm's. Works like a charm when I do this by hand (obviously, these are not real CAD models but facet geometry).
If I run the code below, I get a Type Mismatch error on te line starting with Set Model = session.ImportNewModel...
The weird thing is Creo actually imports the pvz, because if I do File > Open > In Session, I can see and open my example asm (testjaap.asm).
Does anyone know how I can get the model opened?? I tried all kinds of things, but nothing works so far...
Thnx!
Jaap
code:
Sub import_pvzs()
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
Dim model As IpfcModel
Set conn = asynconn.Connect("", "", ".", 5)
Set session = conn.session
Set model = session.ImportNewModel("C:\local\test_buildassyfromtextfile_transformation_matrix\TEST_ASSY_A0120069, Box Packer\A0133910, CRASH CAMS - Cabinet Module.pvz", EpfcNewModelImportType.EpfcIMPORT_NEW_PRODUCTVIEW, EpfcModelType.EpfcMDL_ASSEMBLY, "testjaap", Nothing)
conn.Disconnect (2)
End Sub
