Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding a progress bar in vbs

Posted on 2011-02-23
3
Medium Priority
?
572 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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