I do not see any error in your code but it looks like SldWorks object is not created. Firstly I would suggest you to move the CreateObject function to a Form1_Load function
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
swApp = CreateObject("SldWorks.Application")
Try also to use Activator::CreateInstance instead of CreateObject. Please take a look at this video showing how to setup a Stand-Alone SolidWorks application: https://www.youtube.com/watch?v=aoXJGKAwhbc
Regards, Artem Taturevych | Snr. Developer | IC3D ANZ
IC3DSteel – New Steel Solution for SolidWorks
translationXpert – SolidWorks files language translator
Thank you, I`ll look at it and reply when I get home today. Thanks.
Thank you Artem!