G
G Teachman
Hello,
I have code in a macro that finds something, makes a copy of it, goes to
another document, pastes the selection, returns to the original document.
This works, but I need to do it an unknown number of times in different
documents. So, I tried the following (based on reading a lot in this group).
Do Until ActiveDocument.Bookmarks("\Sel") =
ActiveDocument.Bookmarks("\EndOfDoc")
stuff gets done in here
Loop
The active document does have an EndOfDoc bookmark. (As an aside, I don't
know what the ("\Sel") is for.) The result is an endless loop. It finishes
the document and starts over again. I have to CntlBreak to stop it.
I also tried a suggestion I found here by adding .End in two places. As
seen here.
Do Until ActiveDocument.Bookmarks("\Sel").End =
ActiveDocument.Bookmarks("\EndOfDoc").End
This results in the same behavior as the first try.
Why is the bookmark not being found/recognized and the loop ended?
Thanks,
I have code in a macro that finds something, makes a copy of it, goes to
another document, pastes the selection, returns to the original document.
This works, but I need to do it an unknown number of times in different
documents. So, I tried the following (based on reading a lot in this group).
Do Until ActiveDocument.Bookmarks("\Sel") =
ActiveDocument.Bookmarks("\EndOfDoc")
stuff gets done in here
Loop
The active document does have an EndOfDoc bookmark. (As an aside, I don't
know what the ("\Sel") is for.) The result is an endless loop. It finishes
the document and starts over again. I have to CntlBreak to stop it.
I also tried a suggestion I found here by adding .End in two places. As
seen here.
Do Until ActiveDocument.Bookmarks("\Sel").End =
ActiveDocument.Bookmarks("\EndOfDoc").End
This results in the same behavior as the first try.
Why is the bookmark not being found/recognized and the loop ended?
Thanks,