![]() |
#1
|
|||
|
|||
![]()
I have some timing issues in different subroutines.
Timing issue #1. This subroutine (1) adds text, pastes copied text, manipulates the pasted text; (2) performs (1) with different added text and manipulation; (3) performs (1) with different added text and manipulation... When I tested this manually by stepping through the code, it worked fine. When I ran it normally, it threw errors. So, before I pasted the copied text, I added a subroutine that did nothing but delay for a second. I run the delay right before every instance of pasting text. This corrects the error but creates a "choppy" UI, as this is seen by a user: something happens; it stops; something happens; it stops; etc. Timing issue #2. For this subroutine, I copy text from a currently open document, set an insertion point in that document, open a new document, paste the copied text there, then immediately begin manipulating hidden bookmarks and their corresponding cross-references. After other manipulation, the manipulated text gets copied back to the insertion point in the currently open document and the new document gets closed. I tested this on different computers with the same Word file, and sometimes the manipulation of bookmarks/cross-references works, and sometimes it doesn't. Again, I think there's a timing issue. I think adding a delay before beginning the manipulation of bookmarks/cross-references would work. However, this would make this code run longer (the user does not see the manipulation here, though). This is the code I'm using for a delay (not my code, someone else created it): Code:
Private Sub TIMERUN(SEC As Single) PauseTime = SEC ' Set duration. Start = Timer ' Set start time. Do While Timer < Start + PauseTime DoEvents ' Yield to other processes. Loop End Sub Thank you. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
trevorc | Excel Programming | 8 | 07-08-2018 03:21 AM |
Need help fast! | taavidude | Outlook | 1 | 07-30-2014 01:03 AM |
![]() |
ryanjanus | Mail Merge | 2 | 12-17-2012 07:05 PM |
Addressing mailing envelopes | WildBill | Outlook | 0 | 12-29-2011 03:20 PM |
Outlook 2000 addressing problem | speigel | Outlook | 0 | 11-08-2006 02:06 AM |