Solved

Adding a progress bar in vbs

Posted on 2011-02-23
3
567 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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