Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoEvents, Sleep (Kernel32) & Asynchonrous Tasks

Status
Not open for further replies.

tmktech

MIS
Oct 3, 2002
78
US
I could sure use some help from some of the Tek-Tips pros!!

I'm STUCK!!

I've got an EXCEL VBA app (running in both 2K & XP) that updates the image (bitmap) of an Image control for publishing purposes.

I've got a DoEvents AND a 1 millisecond Sleep after the .loadpicture method because I've had problems keeping the bitmap synchronized with the rest of the spreadsheet changes while publishing (hardcopy, PDF's, .csv, ...)

I have a customer who apparently has a slow server from time-to-time because sporadically (not always)the bitmaps get out of synch.

How can I ensure that the bitmap update has completed before continuing in the macro WITHOUT an arbitrary wait / sleep time that will slow down the macro? (it has the potential for numerous iterations)

(Rob Brokeous, are you still peeking in from time to time????)

Thanks in advance for yoour help!

TMKTECH
 
VBAjedi,

As a possible alternative solution in thread707-612624, you recommended preloading the images on a hidden worksheet. Can you provide more on how to then do a image.loadpicture pointing to a pre-loaded bitmap versus a file pathname?

Also, how do I know that the images have finished loading on the hidden form before beginning my publishing?

This one is itching for a star, P L E A S E......

Zathras? Tony? Skip? xlbo? P L E A S E GUYS / GALS.
 
Maybe you could modify the code in this FAQ...

It works for "Shelled process", but I have not tried to modify it for "do events".

faq707-2542
 
What is this "Sleep" command you are referring to? I have a command line app that I shell to from VB that must complete before VB continues. I solved that with some code recommendations from this forum. The problem is that the shelled to program is a communication app and has problems with comms once in a while. I think that this is due to the fact that VB has jumped to a Kernel32 routine that awaits the shelled app's termination. This in turn may consume max resourses causing the shelled app's miscommunication. I'm sure the shelled app is consuming some but would like to ensure that VB is consuming as little as possible.

Jeff Francis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top