Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
we will be updating Inventor 2021 to 2023 and I have noticed that existing VBA macros no longer work.
After many small tests I could find that the macros do not work if a second model state exists.
Is such a problem known? Can anyone confirm this?
As an example I have prepared a small macro:
Public Sub Test()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oOcc As ComponentOccurrence
Set oOcc = oDoc.ComponentDefinition.Occurrences.Item(1)
Dim oParameters As Parameters
Set oParameters = oOcc.Definition.Parameters
oParameters.Item("Breite").value = 20
End Sub
You need an assembly for it. In this assembly comes a part. And this part needs 2 model states and a parameter called "Breite". Run the macro in the assembly.
The error then appears when setting the parameter value.
If you remove the second model state, the macro works.
Regards
Michael
Solved! Go to Solution.