PDA

View Full Version : Using Progress Bars



xluser2007
06-08-2009, 12:38 AM
Hi All,

I have a simple macro that downloads a file from the net and saves to it a predefined folder (the original macro is from Chip Pearson).

I would like to use a rigorous Progress Bar to indicate how progress is going for the user.

I have found this great examples here:

http://www.oaltd.co.uk/DLCount/DLCount.asp?file=WksPrgrs.zip

Could anyone please show me how to incorporate the above progress bar in my download macro? I've attached sample workbook below.

any help appreciated.

Bob Phillips
06-08-2009, 04:33 AM
I don't think you will get a progress bar to work when downloading a file. A PB needs points at which your code can interrupt and update the PB, a downlaod provides no such interrupts.

xluser2007
06-09-2009, 05:09 AM
I don't think you will get a progress bar to work when downloading a file. A PB needs points at which your code can interrupt and update the PB, a downlaod provides no such interrupts.

Thanks for the information Bob. It isn't that critical for this example.

I just ended up using a simple Application.Statusbar to let the user know that the macro was running in the background.

I do have an example where a progress bar would be useful. I'll post an example in the coming days to get your thoughts on it.

Many thanks once again for your insight.

regards,

Kenneth Hobs
06-09-2009, 05:37 AM
One might have some luck using the last parameter of URLDownloadfile, lpfnCB. I saw one link where IBindStatusCallback was used. As Bob said, the progressbar needs input to update. The idea would be to get the filesize initially and then check FileLen() in the callback. For a vb example, see this link. http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=64914&lngWId=1

This sort of thing using some FTP methods is probably a bit easier.