Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
- Displays the name of the currently active model
- If no model is active, a VBA error message is displayed
- I don't know if the drawing name can be displayed? test it out ^_^
Sub Model_Nanme()
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
Dim Model As pfcls.IpfcModel
Set conn = asynconn.Connect("", "", ".", 5)
Set session = conn.session
Set Model = session.CurrentModel
Call MsgBox(Model.Filename)
'// Disconnect with Creo
conn.Disconnect (2)
'// Cleanup
Set asynconn = Nothing
Set conn = Nothing
Set session = Nothing
Set Model = Nothing
End Sub