in reply to Handle Excel cells with the value #N/A in Perl

Loading Win32::OLE::Variant changes the way Variants are being displayed because it enables overloading of Win32::OLE::Variant objects, forcing a conversion to VT_BSTR type whenever the Variant is being stringified.

The value -2146826246 is actually 0x8000A07FA interpreted as a signed value. If you take it as an unsigned value, then it is 2148141050, which matches the value Excel is supposed to store in a VT_ERROR variant for #N/A.

Checking the Variant type from Perl should work like this:

if (ref($var) eq "Win32::OLE::Variant" && $var->Type == VT_ERROR) { ... }

Replies are listed 'Best First'.
Re^2: Handle Excel cells with the value #N/A in Perl
by Angus (Novice) on Mar 30, 2010 at 14:13 UTC

    Excellent, thank you.