Like rlx loop through all the layouts ignore the one called "Model" then get the table/s and use ssadd to make final selection set.
Mihail post again if want code for "any layout".
If its getting a table from "Model" space then its ignoring this (410 . "Layout*")
Maybe use this, limited testing. Returned correct number.
(if (not (setq ss (ssget "_X" (list (cons 0 "ACAD_TABLE")(cons 410 "Layout*")))))