perlwin32ole

Does Win32::OLE::Const->Load('Microsoft Excel'); depends on Excel version


I'm using Win32::OLE::Const->Load() in perl :

$xl = Win32::OLE::Const->Load('Microsoft Excel');

then I test if scalar(keys %{$xl}) is zero :

 if (scalar(keys %{$xl})==0) {
        return False;
    }
    else {
        return True;
    }

I tested this code in machine which supports Microsoft Excel 2003 it gives True, but when I tested the same code in machine where there is Microsoft Excel 2013 it gives me False!

I also printed the scalar(keys %{$xl} in the first machine it gives 2023, in the second machine it is 0!

Best Regards


Solution

  • after searching I found the solution.

    it gives 0 in the second machine cuz there is no win32 Excel key in the registre.

    the solution is adding win32 key in HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.8\0\