@Kent1Cooper ,
I was looking into your suggestion a bit today but I do not believe it would be what OP wants.
Here's (what appears to be) the best possible solution that could come from iterating through open drawings, but please note that I personally would not want to use this code.
(defun c:XRU ( / )
;; XRefs Update
(vlax-for doc (vlax-get (vlax-get-acad-object) 'Documents)
(vla-postcommand doc "-XREF r *\n")
);vlax-for doc
(prompt "\nXRU Complete.")
(princ)
);defun
What happens is that when the postcommand is applied to each document, we can see in the documentation that:
If the document is not active, the document is made activate and the string is executed when the document has focus.
Which is nice, because we do not have to activate the document, we can merely let the command do that part for us (IF we were to activate it anyway, with (vla-activate ...) then our Lisp routine would not execute fully).
However, we can also see that the latter portion of that sentence states that the string is executed when the document has focus... which, if we are iterating through many documents, will never maintain focus long enough for the command to fully execute.
So what ultimately happens when running that routine, is that the command is INITIATED in each drawing, however it never fully finishes UNTIL the user returns to that document, making it active again.
So, good in theory, but the execution remains bad.
I've tried looking into other methods or approaches in Lisp, either with (eval ..) or blackboard symbols or other (vl ...) functions, but no luck. I think for OP's particular problem, an "acaddoc.lsp" solution or some type of reactor might work best. But without further input, all we can answer was the original question posed.
Best,
~DD