How can I programmatically determine if the activecell is in a query or pivot table (or not in one)?

I can base it off the .Name:
If I get a name, it is a query table. If I get an error, it's not a query table. I can do the same process for a pivot table. I don't want to do it this way so I'm hoping for a simpler, one liner, method.