Interesting. The post you linked uses the UIdoc but I use the UIapp. (See post here.)
Can you post your code so we can see exactly what’s going on? I’d also try using the code I provided in the link and see if that makes a difference.
Edit: Just noticed that I do get the current doc for setting the active view. I’m guessing it’s something in your code.