Triggering an event for a progress bar
Posted on 2006-04-16
I have some VB code I am trying to adapt to VBA in order to zip and unzip files with the AbleZip ActiveX. I am struggling with how to activate a progress bar to show the user progress on the event.
The code below zips a file and the Sub Function is the event to display progress, but I can't seem to put the two together. Can anyone help please?
Public Function ZipDataFile()
Dim AbleZip1 As Object
Dim ResultCode As abeError
' All properties keep their default values Except the two below
Forms!Preferences!AbaleZip1.FilesToProcess = "C:\Program Files\CMITS\My File.mdb"
Forms!Preferences!AbaleZip1.ZipFilename = "C:\Program Files\CMITS\FTP\MyZip.zip"
' Start zipping
ResultCode = Forms!Preferences!AbaleZip1.Zip
' Check the return value.
If ResultCode <> aerSuccess Then
MsgBox "Unsuccessful. Error # " + Str(nErr) + " occurred. " + _
"Description: " + Forms!Preferences!AbaleZip1.GetErrorDescription(avtError, ResultCode)
MsgBox "File(s) successfully zipped."
>>>Here is the File Status event that I am not sure how to incorporate into the above to display progress.
Private Sub xZip_FileStatus(ByVal sFilename As String, ByVal lSize As Long, _
ByVal lCompressedSize As Long, ByVal lBytesProcessed As Long, _
ByVal nBytesPercent As Integer, ByVal nCompressionRatio As Integer, _
ByVal bFileCompleted As Boolean)
ProgressBar1 = nBytesPercent