The reason you're getting that error is that ISldWorks::NewPart doesn't have any arguments. Incidentally those are the arguments that should be provided when creating a new part with ISldWorks::NewDocument, which is the correct way to create a new document.
Please change TEMPLATE_PATH below to use your actual part template.
Const TEMPLATE_PATH As String = _ "C:\ProgramData\SolidWorks\SolidWorks 2011\templates\Part MM.prtdot" Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Sub main() Set swApp = Application.SldWorks Set swModel = swApp.NewDocument(TEMPLATE_PATH, Empty, Empty, Empty) End Sub
Resolving problems like the one above require a knowledge of how to use the API Help. I would also encourage you to check out this article: 7 Mistakes New SolidWorks API Programmers Make
Ah, 'NewDocument' not 'NewPart'. That seems to have worked completely.
I have read through the information you have at CAD-Sharp and other areas and I have been writing VBA for Office applications for over 10 years, but the objects and methods for Solidworks are throwing me around a bit!
What was strange was that the 'NewPart' method almost works. It actually creates a new part using the part template called "sFilename". The error occurs sometime after the instantiation of the model document but before the assignment to swModel.
Yes, I did Excel programming before SolidWorks API programming and they are two different ball games. Learning to use the SolidWorks API Help is essential, whereas with Excel most programmers are able to get away with googling for the code they need.