What am I doing wrong here? Select view

I have some code below as part of my macro. If I do notselect any view, I want a message box to pop-up stating "Mustselect a view". I am getting an error stating

"Run-time error '438': Object doesn't support this property ormethod"

If I select a view, it works.

Any ideas what I am doing wrong? Am I using the right call forgetting the view?

Is swSelMgr.GetSelectedObject6 the correct call?SolidworksApi macros