Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ORange.Paste - gives error message (MS Word Automation)
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
ORange.Paste - gives error message (MS Word Automation)
Miscellaneous
Thread ID:
00403078
Message ID:
00403078
Views:
56
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
Next
Reply
Map
View

Click here to load this message in the networking platform