M
Mahmud
Hi,
I want to do something with code from beginning to end of the document. When
code reaches at the end of document, it will stop. I tried with following
code which seems incorrect because it never shows me the message box saying
"Reached at End of Document", rather the loop continues without stopping.
Sub doSomething()
Selection.HomeKey Unit:=wdStory
Do Until ActiveDocument.Bookmarks("\Sel") =
ActiveDocument.Bookmarks("\EndOfDoc")
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine
Loop
MsgBox "Reached at End of Document"
End Sub
Is there anyone who can tell me what is wrong and how to fix it, please ?
Thanks in Advance
Mahmud
I want to do something with code from beginning to end of the document. When
code reaches at the end of document, it will stop. I tried with following
code which seems incorrect because it never shows me the message box saying
"Reached at End of Document", rather the loop continues without stopping.
Sub doSomething()
Selection.HomeKey Unit:=wdStory
Do Until ActiveDocument.Bookmarks("\Sel") =
ActiveDocument.Bookmarks("\EndOfDoc")
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine
Loop
MsgBox "Reached at End of Document"
End Sub
Is there anyone who can tell me what is wrong and how to fix it, please ?
Thanks in Advance
Mahmud