What is the question?
Do you mean to ask, how to recognise if the active doc is PartDoc, if this is what you want then try,
If swModel.GetType = swDocPART Then
That is one of the strange thing about SW API: you need two objects to work with one file. You always need the ModelDoc object, as this is how to connect to the part. Then you may or may not need the PartDoc or AssemblyDoc or DrawingDoc, if you require access to those API.
Your methods to obtain PartDoc object looks correct. However, if you try to get the PartDoc when the ModelDoc is an assembly or drawing, there will be an error. I suggest you use error handler code such as On Error Resume Next. Also, check to make sure the object is set, perhaps using if/then statement If swPart is Nothing then...