Richard
Wed Sep 05 06:14:48 PDT 2007
The Error function is not available in VBScript. The Err object is.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net
--
"dch3" <dch3@discussions.microsoft.com> wrote in message
news:D8125B31-925C-4C8E-8974-0AE5A4D8CDE4@microsoft.com...
> While technically correct, that doesn't answer my question. Do you work
> for
> Microsoft?
>
> [b]Is the ERROR() function supported by VBScript?[/b]
>
> I had already played with raising the err and then trapping the
> description
> from the error object.
>
> "ekkehard.horner" wrote:
>
>> dch3 schrieb:
>> > Am I correct that VBScript does not support Error()? And that if you
>> > don't
>> > capture the value of Err.Description that your SOL when it come to
>> > needing a
>> > get the description of an error when you only have the code.
>> Kind of brutal, but:
>>
>> Function toErrDescr( nErr )
>> On Error Resume Next
>> Err.Raise nErr
>> toErrDescr = Err.Description
>> On Error GoTo 0
>> End Function
>>
>> Dim nErr
>> For Each nErr In Array( 481, 52 )
>> WScript.Echo nErr, toErrDescr( nErr )
>> Next
>>
>> ==>
>> === getErrDescr: get description from Err.Number ===
>> 481 Ungültiges Bild
>> 52 Ungültige(r) Dateiname oder -nummer.
>> === getErrDescr: 0 done (00:00:00) =================
>>
>>
>>
>>