How to make Win32::OLE work on 64bit MS OFFICE installation - excel

I have two PCs, one has MS Office 2013 32bit installed and another MS Office 64bit installed.
I have Perl code that is using Win32::OLE Perl module to manipulate XLS spreadsheets.
The code is working perfectly fine on 32bit PC, but has a problem on 64bit one.
After doing some research here is what I found out.
The problem is the following line of code:
use Win32::OLE::Const 'Microsoft Excel .* Object Library';
I looked inside Win32::OLE::Const module and it seems that the module is looking for that library in the registry. When I printed out all entries from the registry from both 32 and 64 bit I found out that this library is available on 32bit and not available on 64bit.
Is there a way to install that library on 64 bit? If not, are there any other modules that would allow OLE automation of Excel?
All my Perl script needs to do is to open XLS file and save it as CSV. I am doing it with Spreadsheet::ParseExcel and Spreadsheet::XLSX in all other scripts. The problem with this particular XLS file is that it is password protected and using non-standard password encryption. So Spreadsheet::ParseExcel is not able to open it. Win32::OLE has no issues opening the file on 32bit.
Code can be provided if needed.
Please advise.
Thank you,
-Andrey

I use your Win32::OLE::Const module to have the Excel constants available in Perl.
Recently, I had a clean Win7 x64 install with Office 2016 and the script was not working anymore (using the latest version Win32::OLE::Const module which is installed with the current (on 06/04/2016) ActiverPerl 64 bit installation).
After some investigation, I have found out that the Win32::OLE::Const did not see the Excel automation object although it was well registered and available in the registration database.
In the registration database the following key contains the path to the Excel executable:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\0\Win64
If I add manually a new key
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\0\Win32
with the same path as for the Win64 key then the Perl script found the Excel typelib and worked again.
Hope this helps.

Registry key also helps with Outlook 2013.
/HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00062FFF-0000-0000-C000-000000000046}\9.5\0\win32

Related

VB6 (32bit) custom DLL registered in 64bit Windows 10, but cant initate ActiveX object

I have a 32bit VB6 Custom DLL which I was using all along until Excel 2013, Win-7. Now after moving to Excel 2016 on Win-10, the Excel file is rendered un-usable. I have done the Registration of that old DLL file on Win-10 via PowerShell (Admin mode) and it says registration successful. However, when the module in Excel executes creating the Object via CreateObject, it says ActiveX cannot create Object.
Another surprise that when I try to reference the VB6 DLL from (in Excel) Tools -> Reference, i can reference it and I can access the Class/Functions, but still when I try to execute it, it says the same error about ActiveX.
what else do I need to do in Windows-10 to have it run ?
32 bit programs can only load 32 bit dlls. 64 bit programs can only load 64 bit dlls. This is important. In COM which VB6 and Excel do, you can do non compatible bitness by forcing the wrong bitness dll into dllhost. All calls are marshalled with EXE servers. See https://learn.microsoft.com/en-us/windows/win32/com/registering-the-dll-server-for-surrogate-activation (note goggle sabotages searches for Windows).

SSIS and 64bit excel

I have researched this thoroughly but I've yet to find a satisfactory answer.
I am using SQL Server Data Tools 2010 and Microsoft Office 2013 64-bit. I know that there is a compatibility problem and I am trying to solve it because I know for a fact that you can use an .xlsx file as a data source in a Data Flow.
First I tried setting Run64BitRuntime to False in Project -> Properties -> Configuration Properties - > Debugging but it didn't work
Whenever I try importing an .xlsx file I get the same error
Microsoft Visual Studio
------------------------------
Could not retrieve the table information for the connection manager
'Source Path'. Failed to connect to the source using the connection
manager 'Source Path'
------------------------------
So I tried downloading the "Microsoft Access database engine 2010" as so many suggested. The 64-bit installed successfully but the 32-bit returned the following error
You cannot install the 32-bit version of Microsoft Access database engine 2010
because you currently have 64-bit Office products installed.
Now I know I am missing a step here cause while I can see "Microsoft Access database engine 2010" in the list of installed programs in control panel it does not show up as an option in the Provider list when I am trying to create a new Connection Manager.
So before I result following the instruction on this blog I would like to ensure there is no easier way of solving the problem
Thank you in advance for you time.
If you're machine is x64, forget about Excel, as there is no driver available.
Just convert the file to CSV and use a Flat File Connector instead.
Ok, the answer was so ridiculously easy that I kind of feel ashamed for this post now.
If you are using Microsoft Office 2013 64-bit and want to work with SSIS you have to download and install the 32-bit Microsoft Access Database Engine 2010 Redistributable, not the 64-bit, set Run64BitRuntime to False and everything will work like a charm.

Alternatives to excel addin "morefunc" at 64bit

I've a lot of documents in excel that using the morefunc's formulas (done with my excel 32bit).
Today i've discovered that there are no other version of this addin. Has the developer abandoned the development?
Unfortunatly this addin works only with 32bit version of excel
What can we do to use our documents in a machine that has installed 64bit version of Office?
There is an alternative for this addin? Something that defined the same functions with the same parameters..
Can't you just install a 32-bit version of Excel? Maybe in a virtual machine or VDI (Virtual desktop infrastructure), if you have troubles installing it on your machine?
While this will require adding macros to your documents, you might want to use VBA to emulate Morefunc's functions. All of them have VBA alternatives.

Is MS Office necessary when using Microsoft.Jet.OLEDB provider?

I am trying to read an excel file an can do it using ADO.
My question is, do I need to have office installed when reading an excel file using the Jet.OLEDB Provider?
Currently I'm only testing on pcs that have office installed, that's why I'm asking.Programming language in concern is VB6.
Thanks.
No, you won't need to have office installed, but you will need to have MDAC/WDAC (which contains Jet) installed. On newer operating systems, this is part of the OS. On older OS's (Win 95/98/possibly even 2000), you needed to run an MDAC installer.
No - The Jet driver is used for reading any form of DB files from text files to Excel to Access and is offered my Microsoft independantly of Office.

SSIS 2008 and Excel Interop assemblies

Have an SSIS 2008 package that runs just fine on my local dev machine with Office 2007 installed. It has a script task with interop.excel as a reference. (I'm reformatting some excel sheets with it)
So everything works like a champ until I install and run it on my test SQL 2008 (Server 2008 64bit) server. I install to SSIS, execute it via a SQL Server Job, it runs though most of the steps but then throws an exception when it gets to the script task that needs the excel interop assembly.
I've installed the 2007 PIA and have execution marked as 32bit as well. At this point I'm just kind of lost. Any help is appreciated.
This script task - Is it a .NET script task or a 32-bit script task?
I'm guessing from the interop.excel reference, that its a .NET script task calling out to an old 32-bit library? Can you confirm?
If there is a 32-bit component that you are running on your Win64 environment then you need to be careful about what you are using to register it. By default, regsvr32 is the 64-bit version, so you need to use the regsvr32.exe under c:\windows\systemWOW64 (or something similar). This will ensure the dll is registered in the 32-bit hive of the registry, and available to the WOW (windows-on-windows) emulation environment.
SpreadsheetGear for .NET is an Excel compatible spreadsheet component for 32 bit and 64 bit .NET, and has an API which is similar to Excel's COM API.
You can see some live ASP.NET samples here and download the free trial here.
Disclaimer: I own SpreadsheetGear LLC
I installed Office 2007 on the server I was using. That fixed one problem. Then I discovered another problem that was alleviated by this SO Link

Resources