The code below works fine when swPart is defined as a generic object, and when I use the TypeName function to get the specific type of object, VBA tells me that it is a "PartDoc". However, the code below produces the error shown in the screenshot when it is compiled.
Dim swApp As SldWorks.SldWorks, swPart As PartDoc
Set swApp = Application.SldWorks
Set swPart = swApp.ActivateDoc("Example.sldprt")
Debug.Print swPart.SetMaterialPropertyName("Custom Materials.sldmat", "Stainless Steel (ferritic)")
Clicking "Okay" puts the editor in debug mode and highlights ".SetMaterialPropertyName". So my question is, why can't I assign swPart to the class that it ends up being anyhow?