Dim gdocProgressBar 'Required global declaration for status bar document
Dim goieProgressBar 'Required global declaration for Internet Explorer object
Set gdocProgressBar = Nothing
Set goieProgressBar = Nothing
Dim x
For x = 0 To 100
ProgressBar x
WScript.Sleep 10
Next
For x = 100 To 0 Step -1
ProgressBar x
WScript.Sleep 10
Next
WScript.Sleep 1000
ProgressBar -1
Sub ProgressBar(intPercent)
'Requires global declaration for gdocProgressBar and goieProgressBar
'Creates an html page showing a status bar.
'intPercent must be between 0 and 100.
'If intPercent is out of range, the status bar is shut down.
'Create the status bar window
If gdocProgressBar Is Nothing Then
If ((Cint(intPercent) >= 0) And (Cint(intPercent) <= 100)) Then
Set goieProgressBar = CreateObject("InternetExplorer.Application")
goieProgressBar.Offline = True
goieProgressBar.AddressBar = False
goieProgressBar.Height = 100
goieProgressBar.Width = 250
goieProgressBar.MenuBar = False
goieProgressBar.StatusBar = False
goieProgressBar.Silent = True
goieProgressBar.ToolBar = False
goieProgressBar.Navigate "about:blank"
Do While goieProgressBar.Busy
WScript.Sleep 100
Loop
'On Error Resume Next
Set gdocProgressBar = Nothing
Do Until Not gdocProgressBar Is Nothing
WScript.Sleep 100
Set gdocProgressBar = goieProgressBar.Document
Loop
gdocProgressBar.Open
gdocProgressBar.Write "
"
gdocProgressBar.Write "Status"
gdocProgressBar.Write ""
gdocProgressBar.Write ""
gdocProgressBar.Write ""
gdocProgressBar.Write "  | |
"
gdocProgressBar.Close
goieProgressBar.Visible = True
Else
Exit Sub
End If
End If
'Close the status bar window
If Not gdocProgressBar Is Nothing Then
If ((Cint(intPercent) < 0) Or (Cint(intPercent) > 100)) Then
goieProgressBar.Visible = False
Set gdocProgressBar = Nothing
goieProgressBar.Quit
Set goieProgressBar = Nothing
Exit Sub
End If
End If
'Update the status bar window
If Cint(intPercent) = 0 Then
gdocProgressBar.all.status.width = "1%"
gdocProgressBar.all.status.bgcolor = "#FFFFFF"
Else
gdocProgressBar.all.status.width = Cstr(Cint(intPercent)) & "%"
gdocProgressBar.all.status.bgcolor = "#0000FF"
End If
End Sub