progressbar och erroreporting fastnar vbscript
Hej
Får inte loggning att fungera med progressbar
Kommenterar jag bort progressbaren så fungerar loggningen, med progressbaren inte alls.
Något tips?
If ProgressBar(....
If Err.Number
count = 100
For i = 1 To count
On Error Resume Next
Output i.Name
If ProgressBar(count, "Working!") = "abort" Then
msgbox "Aborted"
Exit For
End If
If Err.Number <> 0 Then errorLog i, count
On Error Goto 0
Next
Function ProgressBar(maxInt, caption)
'ProgressBar
'If ProgressBar(100, "Working!") = "abort" Then msgbox "Aborted"
Set CProg = CreateObject("ComosXMLContent.Progress")
CProg.Caption = caption
CProg.Startprocess
For i = 1 To maxInt
CProg.Percentage = i
If CProg.State = 3 Then
ProgressBar = "abort"
Exit For
End If
Next
CProg.StopProcess
End Function
Function errorLog(input, count)
'errorLog
'https://msdn.microsoft.com/en-us/library/sbf5ze0e.aspx
Set objFSO = CreateObject("Scripting.FileSystemObject")
outFile = "h:\temp\log.txt"
Set objFile = objFSO.CreateTextFile(outFile, True)
If input = 1 Then str = "": str = i & " " & "Error Code: " & Err.Number & " " & Err.Description
If input <> 1 Then str = str & vbCrLF & i & " " & "Error Code: " & Err.Number & " " & Err.Description
Output input & " " & count
If input = count Then
objFile.Write str
objFile.Close
End If
Err.Clear
End Function