Results 1 to 12 of 12
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Progress Bar (XP)

    Using Excel VBA is it possible to create a progress bar to display the percentage of a file being copy/moved by code?

    Thanks,
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Progress Bar (XP)

    You can display a progress bar control on a userform, or you can set the text of Excel's status bar to something that indicates progress, but the problem is that Excel doesn't give feedback to your VBA code about the percentage completed, so you don't know what value to display.

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (XP)

    Hans,

    I know I can obtain the filesize of the file being copied/moved. Is there a possibility of determining how may MB of the file that has actually been copied/moved. If this were possible then it would appear to be a simple division calculation (numeric value) that could be passed to the progress bar of a userform.

    Regards,
    John

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Progress Bar (XP)

    If that is possible, it it beyond me. It would probably involve use of Windows API functions.

  5. #5
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Progress Bar (XP)

    Have a peek into the example in this post: <post#=683,998>post 683,998</post#> thanks to <!profile=wdwells>wdwells<!/profile>.
    Regards,
    Rudi

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Progress Bar (XP)

    That example is useful if you have an idea in advance how long an action will take. But how do you determine in advance how long copying a file will take on the user's PC? <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  7. #7
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Progress Bar (XP)

    <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15>...point taken <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>
    Regards,
    Rudi

  8. #8
    3 Star Lounger
    Join Date
    Nov 2005
    Location
    Asia Pacific, Bangkok Metropolis
    Posts
    378
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (XP)

    John

    The progress bar has a Min and Max value property that the Value must be in between, for example min = 0, max = 100, value = 50,
    progress bar is 50% complete. This is a simple description but depending on what you are doing and a max value of 100 might not be enough.
    The tricky part is working out what is the increment Value so that it finishes at the Max when your code is finished.

    Check these links out, they should give you some ideas to start with

    http://msdn2.microsoft.com/en-us/library/aa733669.aspx
    http://msdn2.microsoft.com/en-us/t9fzsyec.aspx
    http://msdn2.microsoft.com/en-us/library/aa443485.aspx

    hope this help
    Hope this is helpful

    francis, <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    My Reading

    Pivot Table 101
    Pivot Table
    Array

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Progress Bar (XP)

    Franciz,

    The links you provided are useful for learning how to set up a progress bar in general. But they don't tell us how to get information on how much of a file has been copied at any given moment. That is the real problem here...

  10. #10
    3 Star Lounger
    Join Date
    Nov 2005
    Location
    Asia Pacific, Bangkok Metropolis
    Posts
    378
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (XP)

    Hans,

    I agreed with you on this. The links provided are meant for a starting guide, I hope that going thru these may lead to some ideas in
    generating a solution to the request.

    regards, francis
    Hope this is helpful

    francis, <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    My Reading

    Pivot Table 101
    Pivot Table
    Array

  11. #11
    3 Star Lounger
    Join Date
    Nov 2005
    Location
    Asia Pacific, Bangkok Metropolis
    Posts
    378
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (XP)

    This may be what you are looking for, see the thread at the below link. Its refering to reading bytes of the file and updating them to the progress bar.

    http://forums.microsoft.com/MSDN/ShowPost....537101&SiteID=1

    hope this help.

    regards, francis
    Hope this is helpful

    francis, <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    My Reading

    Pivot Table 101
    Pivot Table
    Array

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Progress Bar (XP)

    Thanks, John should be able to find what he needs there. (It may be more than he wanted to know, but that's not your fault)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •