How can I use "loop" in my macro code. For example I want my macro to reruns back to first line of the code and repeats again.
a Macro to loop a function
Collapse
X
-
I want to the function to be repeated again and again in the document till the end of document.
I used this code:
Code:Do Until ActiveDocument.Bookmarks("\Sel") = _ ActiveDocument.Bookmarks("\EndOfDoc") '(Do something) Loop
Comment
-
Ctrl-Break can normally stop code executing.
As for your code, I'm pleased it's VBA rather than Access Macros, yet I'm confused as to why you would ask such a question without including so many of the relevant details. It now appears that it is Word VBA we are dealing with.
From your code, I see nothing that would ever move the selection forward, so am not surprised that it results in an interminable loop. How you should manage your loop depends on what you are doing and what you want. Without knowing either of these I cannot be of any further help at this time.Comment
Comment