Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

How to make sure DoEvents complete its job?

  Asked By: Diane    Date: Feb 10    Category: MS Office    Views: 922
  

In the following code, I found that Cntl+v does not always work:

... from Excel VBA go to Word document ...
sendkeys "^v" 'paste from clipboard to Word document
doevents

(1) instead of doevents, I could do-- Application.wait now+ timevalue
("00:00:01"). But, I found this is not 100% fool proof, sometimes
Cntl+v did not complete its job

(2) so, I want to do

do
doevents
loop until condition1 <> condition2

I think it will be fool proof. The only problem is that it is not
so obvious what to specify in condition 1 and 2? I think in this
case condition1 is before-pasting, condition2 is after-pasting. If
after-pasting <> before-pasting, then cntl+v has done its job. But
what should I code in condition 1 and 2?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How to make sure DoEvents complete its job? Or get search suggestion and latest updates.




Tagged: