I have two documents that I am automating. One is created from scratch the other has fields within pre-written text that are filled in. The first document is created then I cut all of its text and paste it into the second document. I use bookmarks to determine where the first document is pasted into the second document.
The problem is I keep getting an error message when I try to paste the first document. The error message is something like "the clipboard is either empty of invalid". But when I suspend the program and go into the debugger and hit F8 to step through the line that just caused the error the line executes fine with no error. It is consistent, every time it gives a error and every time I can just step right through the line in the debugger and it works fine. If I suspend the program right before the line I can also step through it. It seems that it just won't run outside the debugger. Any ideas?
Here is the code:
_CLIPTEXT = '' && clear the clipboard
oDoc2.RANGE.COPY
oWord2 = oDoc2.PARENT
oDoc2.CLOSE(wdDoNotSaveChanges)
oWord2.QUIT()
oRange1 = oDoc.RANGE.GOTO(wdGoToBookmark ,,,"Chapter10beg")
oRange1.InsertBreak(wdPageBreak)
oRange1.Paste && here is the line that causes the error
_CLIPTEXT = '' && clear the clipboard
Rip Ryness
International Falls, MN