Get Configurations Referenced in View Example (VBA)
This example shows how to get the names of the configurations referenced
in each drawing view in the drawing sheet.
'-------------------------------------
'
' Preconditions: Drawing document is open.
'
' Postconditions: None
'
'--------------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swDraw As
SldWorks.DrawingDoc
Dim
swView As
SldWorks.view
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swDraw = swModel
Debug.Print
"File = " & swModel.GetPathName
Set
swView = swDraw.GetFirstView
Do
While Not swView Is Nothing
Debug.Print
" View
= " + swView.Name
Debug.Print
" Model
= "
+ swView.GetReferencedModelName
Debug.Print
" Config
= " + swView.ReferencedConfiguration
Set
swView = swView.GetNextView
Loop
End Sub
'-------------------------------------