Solved

Adding a progress bar in vbs

Posted on 2011-02-23
3
570 Views
Last Modified: 2012-05-11
I have some code that I found online which works perfectly. The code unzips a files to C:\temp. The only thing it is missing is a progress bar. The zip file is fairly big so it does take some time to extract. I wold like to ave something that the users can see it is in progress.

Thanks
'Adapted from http://www.robvanderwoude.com/vbstech_files_zip.html
 
strFile = "c:\temp\file.zip"
strDest = "c:\temp\"
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
If Not objFSO.FolderExists(strDest) Then
    objFSO.CreateFolder(strDest)
End If
 
UnZipFile strFile, strDest

Sub UnZipFile(strArchive, strDest)
    Set objApp = CreateObject( "Shell.Application" )
    
    Set objArchive = objApp.NameSpace(strArchive).Items()
    Set objDest = objApp.NameSpace(strDest)
 intOptions = 256
    objDest.CopyHere objArchive, intOptions
     
End Sub

Open in new window

0
Comment
Question by:clynch302
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Expert Comment

by:shaydie
ID: 34962502
You might check this link.. sample script how to use IE to display a progress bar.

http://www.computerperformance.co.uk/ezine/ezine88.htm
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 34965959
Hi there, try this.

Regards,

Rob.
Const FOF_CREATEPROGRESSDLG = &H10&

'Adapted from http://www.robvanderwoude.com/vbstech_files_zip.html
 
strFile = "c:\temp\file.zip"
strDest = "c:\temp\"
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
If Not objFSO.FolderExists(strDest) Then
    objFSO.CreateFolder(strDest)
End If
 
UnZipFile strFile, strDest

Sub UnZipFile(strArchive, strDest)
	Set objApp = CreateObject( "Shell.Application" )
    
	Set objArchive = objApp.NameSpace(strArchive).Items()
	Set objDest = objApp.NameSpace(strDest)
	objDest.CopyHere objArchive, FOF_CREATEPROGRESSDLG
End Sub

Open in new window

0
 

Author Closing Comment

by:clynch302
ID: 35012800
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month7 days, 9 hours left to enroll

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question