Code is to get all components in an assembly and print out component file name with path.
Sorry I do not know what you mean by "don't traverse method, set oSwModel = SwComp???" SwComp.GetModelDoc is the correct call.
Check out the Remark: for GetModelDoc2 Method (IComponent2)
This method might return Nothing or null if:
- a component is suppressed or lightweight.
- the component ID is not loaded into memory by SOLIDWORKS.
Maybe its failing because of above reasons...
Thank you for your reply, put the question to solve complicated.
With a simple statement to achieve the goal
Set SwModel = SwApp.GetOpenDocument(ModelName)
Your second post is different than your first. Instead of showing code, describe what you are trying to accomplish.