Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a Part Document with various Model States. I have a macro which I would like to have change the active model state in its Drawing Document. Here is a snippet of code I am using. On the DV.ActiveModelState line, I am getting an error stating incorrect number of arguments of an invalid property assignment. Is there something wrong with this?
Sub ChangeModelState()
Dim PN As String
PN = "999998"
Dim app As Application
Dim IDW As DrawingDocument
Set app = ThisApplication
Set IDW = app.ActiveDocument
Dim DV As DrawingView
Set DV = IDW.ActiveSheet.DrawingViews(1)
Dim DVfp As DrawingView 'Flat pattern
Dim view As DrawingView
Dim oPart As PartDocument
Set oPart = IDW.ReferencedDocuments.Item(1)
Dim oModelState As ModelState
Set oModelState = oPart.ComponentDefinition.ModelStates
For Each view In IDW.ActiveSheet.DrawingViews
If view.IsFlatPatternView = True Then
Set DVfp = view
End If
Next view
Dim fileName As String
Dim i As Long
Dim memberName As String
memberName = "[Primary]"
DV.ActiveModelState = memberName
DVfp.ActiveModelState = memberName
End Sub
Solved! Go to Solution.