- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I recently upgraded to 2022 cad from 2019. I have the following lines that I run to unload the Vault Add-in before subroutines to avoid all the vault "Do you want to check this out" prompts for each file, and then reload afterward.
Sub VaultAddIn()
Dim strResponse As String
strResponse = MsgBox("Yes=Load, No=Unload, Cancel=Do Nothing", vbYesNoCancel, "Do you want to load/unload Vault Add In?")
Select Case strResponse
Case vbYes
ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Activate
Case vbNo
ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
End Select
End Sub
When the .Activate line is run, I get the following error. I used to get this error in INV2019 about 10% of the time, but now in 2022 I get it every single time. I want to add that I get this error when I have an assembly opened. If I open Inventor and no file is open, I can unload/load the vault addin as much as I want through the API with no errors.
If I load/unload via the GUI from Tools->Add-Ins, the vault fails to load properly, again if an assembly is already opened. I can still check files in/out, but several ribbon buttons are missing from the Vault Tab. If I pull the GUI up again, it says the Vault Add-in is still unloaded. Below are some UI snips to display the odd behavior.
Vault Tab
Context Menu, Extra "Vault"
I noticed that the vault add-in is in the \ProgramData folder, while all the other add-ins are in \Program Files. Is this supposed to be here? Could the fact that this folder is Hidden be causing this problem? My user account has full admin privileges, and also running INV as admin makes no difference.
Any help with this would be greatly appreciated. Many thanks in advance.
Rafael
WIN10 x64 PRO, INV2022.1.1 PRO
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Would this help:
Sub VaultAddIn()
Dim strResponse As String
strResponse = MsgBox("Yes=Load, No=Unload, Cancel=Do Nothing", vbYesNoCancel, "Do you want to load/unload Vault Add In?")
Dim aai As ApplicationAddIn =ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}")
Select Case strResponse
Case vbYes
aai.Activate
Case vbNo
aai.Deactivate
aai= Nothing
End Select
End Sub
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you for the response. That is fascinating. I referenced the addin with an object per your comment and now I get no error.
There seems to be some changes to how VBA operates in this version. For example, I have public variables I use for Excel declared with this: Public oExcel As Object, oWorkbook As Excel.Workbook. I could create Excel applications and workbooks with no problems in INV2019 and INV2022. I then updated to INV2022.1.1, and my code kept failing on this line: Set oWorkbook = oExcel.Workbooks.Add. Nothing had changed with my references, I only updated inventor. The way I got it to work again was changing how I declared the workbook object: oWorkbook As Object. How can something like this be affected by an INV update?
Thanks again for the help.
Regards,
Rafael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This was doing the trick:
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I actually got this same error again. In my implementation, I deactivate first, then active at the end. Here is my code. It is basically showing a userform that allows the user to pick the macro they want to run. Only certain macros need the vault add-in unloaded.
Sub UniversalNew()
strSoftwareName = "Abtex Inventor Suite " & strVersion
Dim boolUnloadVault As Boolean
boolUnloadVault = True
iActiveScreen = 0
CurrentEnvironmentNew = ActiveEnvironmentNew
SelectedProgramNew = vbNullString
UniversalFormComplete = False
UniversalFormCancelled = False
UserForm_Universal.Label_Message.Caption = vbNullString
UserForm_BillOfMaterial.Label_Message.Caption = vbNullString
UserForm_OtherMacros.Label_Message.Caption = vbNullString
UserForm_Universal.Caption = strSoftwareName
UserForm_BillOfMaterial.Caption = strSoftwareName & " - Bill of Material"
UserForm_OtherMacros.Caption = strSoftwareName & " - Other macros"
'Run Userform to collect information
UserForm_Universal.Show
Do Until UniversalFormComplete = True
DoEvents
Loop
If UniversalFormCancelled = True Then
'MsgBox "User Cancelled. Click Okay to terminate."
End
End If
Dim aai As ApplicationAddIn
Set aai = ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}")
Select Case SelectedProgramNew
Case "BOM"
If boolUnloadVault = True Then aai.Deactivate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
Call ExportBOM.ExportBOM
Case "Format BOM"
Call FormatBOM.FormatBOM
Case "Generate Thumbnails"
If boolUnloadVault = True Then aai.Deactivate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
Call GenerateThumbnails.GenerateThumbnails
Case "Generate Brush"
Call MakeBrush_Tufted.TuftedBrush
Case "Create GPN"
Call FillProperties.CreateGPN
Case "Finish"
Call MakeFinish.MakeFinish
Case "Toggle Part Number"
Call ToggleColumnVisibility.TogglePartNumber
Case "Determine Parents"
Call FillProperties.DetermineParents
Case "Rename Occurences"
Call RenameOccurences.RenameOccurences
Case "Export Drawings"
If boolUnloadVault = True Then aai.Deactivate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
Call ExportDrawings.Main
Case "Merge BOMs"
Call MergeBOMs.MergeBOMs
Case "Merge PDFs"
Call OpenPDFSAM.OpenPDFSAM
Case "Copy Sheet"
Call CopySheet.IDW_DuplicateSheet
Case "Add Part Number"
Call AddPartNumber.AddPartNumber
Case "Add Layer PN"
Call AddPartNumber.AddLayerPN
Case "Import Fastener"
Call ImportFastener.ImportFastener
Case "Delete Custom Properties"
Call DeleteCustomProperties.DeleteCustomProperties
Case "Adjust View"
Call AdjustView.CallUserForm
Case "Check Param and Rule"
Call AddPartNumber.CheckParamAndRule
Case Else
MsgBox "An error has occured."
End Select
'Reactivate Vault is failing
If boolUnloadVault = True Then aai.Activate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Activate
Set aai = Nothing
'MsgBox "Ending program"
End
End Sub
Any idea what might be happening? Any help would be appreciated.
Thank you.
Rafael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Exact reverse:
Case "BOM"
If boolUnloadVault = True Then aai.Deactivate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
aai= nothing
Call ExportBOM.ExportBOM
Case "Format BOM"
Call FormatBOM.FormatBOM
Case "Generate Thumbnails"
If boolUnloadVault = True Then aai.Deactivate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
aai= nothing
Call GenerateThumbnails.GenerateThumbnails
Case "Generate Brush"
Call MakeBrush_Tufted.TuftedBrush
Case "Create GPN"
Call FillProperties.CreateGPN
Case "Finish"
Call MakeFinish.MakeFinish
Case "Toggle Part Number"
Call ToggleColumnVisibility.TogglePartNumber
Case "Determine Parents"
Call FillProperties.DetermineParents
Case "Rename Occurences"
Call RenameOccurences.RenameOccurences
Case "Export Drawings"
If boolUnloadVault = True Then aai.Deactivate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Deactivate
aai= nothing
Call ExportDrawings.Main
Case "Merge BOMs"
Call MergeBOMs.MergeBOMs
Case "Merge PDFs"
Call OpenPDFSAM.OpenPDFSAM
Case "Copy Sheet"
Call CopySheet.IDW_DuplicateSheet
Case "Add Part Number"
Call AddPartNumber.AddPartNumber
Case "Add Layer PN"
Call AddPartNumber.AddLayerPN
Case "Import Fastener"
Call ImportFastener.ImportFastener
Case "Delete Custom Properties"
Call DeleteCustomProperties.DeleteCustomProperties
Case "Adjust View"
Call AdjustView.CallUserForm
Case "Check Param and Rule"
Call AddPartNumber.CheckParamAndRule
Case Else
MsgBox "An error has occured."
End Select
'Reactivate Vault is failing
If boolUnloadVault = True Then aai.Activate 'ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Activate
'MsgBox "Ending program"
End
End Sub
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How will aai.Activate work if the object aai is set to nothing beforehand?
Rafael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
you need to release the memory after unloading the add in.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I get the following error because the object is not set at the line aai.Activate.
This way seems to work though. I have executed multiple times in a row with no error.
Dim aai As ApplicationAddIn
Set aai = ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}")
aai.Deactivate
Set aai = Nothing
ThisApplication.ApplicationAddIns.ItemById("{48B682BC-42E6-4953-84C5-3D253B52E77B}").Activate
Thank you.
Rafael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks for all the help. I have one last oddball that occurs now since the update to INV2022.1.1. I have the following snippets of code that I use to keep INV minimized while capturing thumbnails of multiple parts to prevent the cursor from highlighting faces. The screen still minimizes just fine, but then it pops up again on a file open. This did not happen in INV2022 prior to the update. Any thoughts?
Public oApp As Inventor.Application
Set oApp = GetObject(, "Inventor.Application") 'Set reference to the running instance of Inventor
Call InventorScreen(oApp, False, False, True) ' Minimize Inventor and disable screen updates
----------------------------------------------------------------------------
Public Sub InventorScreen(ByRef oApp As Inventor.Application, Visible As Boolean, ScreenUpdating As Boolean, Minimized As Boolean)
If Visible = True Then
oApp.Visible = True
ElseIf Visible = False Then
oApp.Visible = False
End If
If ScreenUpdating = True Then
oApp.ScreenUpdating = True
'oApp.ActiveView.Update
ElseIf ScreenUpdating = False Then
oApp.ScreenUpdating = False
End If
If Minimized = True Then
oApp.WindowState = kMinimize
ElseIf Minimized = False Then
oApp.WindowState = kMaximize
End If
End Sub
Many thanks.
Rafael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This will work:
Public Sub Main()
Dim oApp As Inventor.Application
Set oApp = GetObject(, "Inventor.Application") 'Set reference to the running instance of Inventor
Call InventorScreen(oApp, False, False, True) ' Minimize Inventor and disable screen updates
End Sub
Public Sub InventorScreen(ByRef oApp As Inventor.Application, Visible As Boolean, ScreenUpdating As Boolean, Minimized As Boolean)
If Visible = True Then
oApp.Visible = True
ElseIf Visible = False Then
oApp.Visible = False
End If
If ScreenUpdating = True Then
oApp.ScreenUpdating = True
'oApp.ActiveView.Update
ElseIf ScreenUpdating = False Then
oApp.ScreenUpdating = False
End If
If Minimized = True Then
oApp.WindowState = kMinimize
ElseIf Minimized = False Then
oApp.WindowState = kMaximize
End If
End Sub
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm not sure what you changed, aside from placing the snippets with a Public Sub. I have the Public variable declared above my main function, and the Set oApp and Call InventorScreen lines within the Main subroutine.
Rafael