Hello
Open the StandardAddInServer.vb with an Texteditor, scroll down to the end and replace the OnSave-Sub with this:
Private Sub m_applicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_applicationEvents.OnSaveDocument
If BeforeOrAfter = EventTimingEnum.kBefore Then
'Lets make sure that the active document is a part document
If m_inventorApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Try
Dim invVBAProject As InventorVBAProject = m_inventorApplication.VBAProjects.Item(1)
Dim invModule As InventorVBAComponent = invVBAProject.InventorVBAComponents.Item("Module01")
Dim invSub As InventorVBAMember = invModule.InventorVBAMembers.Item("Main")
invSub.Execute()
Catch ex As Exception
End Try
End If
If m_inventorApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Try
Dim invVBAProject As InventorVBAProject = m_inventorApplication.VBAProjects.Item(1)
Dim invModule As InventorVBAComponent = invVBAProject.InventorVBAComponents.Item("Module01")
Dim invSub As InventorVBAMember = invModule.InventorVBAMembers.Item("Main")
invSub.Execute()
Catch ex As Exception
End Try
End If
If m_inventorApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
Try
Dim invVBAProject As InventorVBAProject = m_inventorApplication.VBAProjects.Item(1)
Dim invModule As InventorVBAComponent = invVBAProject.InventorVBAComponents.Item("Module01")
Dim invSub As InventorVBAMember = invModule.InventorVBAMembers.Item("Main")
invSub.Execute()
Catch ex As Exception
End Try
End If
End If
End Sub
EDIT: compiled dll attached (replace txt with dll)
R. Krieg
RKW Solutions
www.rkw-solutions.com