Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. 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