简体   繁体   中英

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

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\\

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM