right after this: (as tharwats suggestion)
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
Before you processed the block, run this as a test for block name
(setq BlkName (vla-get-effectivename (vlax-ename->vla-object (ssname ss 0))))
it will you give you name of the block for your test/cond
(if (eq BlkName "qq") (.... <----- test
But if you're going to select on screen as the example suggest, you dont really need to do this as you already know you're selecting the correct block, but if you have the need for the blockname then you should run the test.
Now if you select the entire database using "_X" (meaning no prompt for selection on the screen)
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "*U*,qq"))))
Then you need to run it through the test before you worked on the block
That is just how Dynamic Block behaves (Autodesk needs to do something about this I guess), converting it to an anonymous name
Hope this helps