Inventor 2014 no longer supports VBA auto-run macros. Here is an excerpt from the Inventor API help file:
Autodesk Inventor 2014 removes support for VBA auto-run macros that are embedded in Autodesk Inventor documents. The VBA macros are AutoOpen, AutoNew, AutoSave, AutoClose, and AutoEdit. They can severely impact Autodesk Inventor performance, and pose a possible security risk. The suggested alternative to auto macros is an add-in. Add-ins don't have the performance and security issues of auto macros and provide much better source control.
If you are using VBA auto-run Macros you will need to start using events to get the same functionality. In one case the AutoSave macro was being used to add the time and day to custom iProperties. This stopped working in Inventor 2014. To get the behavior back an Add-In with an OnSaveDocument event needed to be used. Here is the VB.NET (VS 2010) project that creates an Add-In that that can be used to replace the behavior of the AutoSave VBA macro.
Download AddIn_With_Saved_Event
There are instructions for creating an Add-In in the API help file.
.
Here is the event callback:
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)
If BeforeOrAfter = EventTimingEnum.kBefore Then
Try
'Ensure active document is a Drawing
If m_inventorApplication.
ActiveDocumentType = _
DocumentTypeEnum.kDrawingDocumentObject Then
'Get the custom iProperties
Dim oPropSet As PropertySet = _
m_inventorApplication.ActiveDocument.PropertySets _
("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
Dim bDateAdded As Boolean = False
Dim bTimeAdded As Boolean = False
Dim prop As Inventor.Property
For Each prop In oPropSet
If prop.Name = "SysDate" Then
prop.Value = _
Format(Date.Now, "MMM-d-yy")
bDateAdded = True
End If
If prop.Name = "SysTime" Then
prop.Value = _
Format(Date.Now, "hh:mm:ss tt")
bTimeAdded = True
End If
Next
' If the drawing does not have the
' SysDate custom property
If bDateAdded = False Then
oPropSet.Add(Format(Date.Now, _
"MMM-d-yy"), "SysDate")
End If
' If the drawing does not have the
' SysTime custom property
If bTimeAdded = False Then
oPropSet.Add(Format(Date.Now, _
"hh:mm:ss tt"), "SysTime")
End If
End If ' if document is a drawing
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End If 'if before save
End Sub
-Wayne