I have a legacy business application written in VBA in Excel. It uses the VBA DAO library (installed at c:\program files (x86)\Common Files\Microsoft Shared\DAO\dao360.dll
) and the classes Workspace
, Database
, DBEngine
, Connection
) to connect to a SQL database via ODBC.
It works properly up to Windows 7, but on Windows 8 /Server 2012, it doesn't work, on the very first call to DAO:
Set ws = DBEngine.CreateWorkspace(wsName, "", "", dbUseODBC)
raises a runtime error number 3633 description "Cannot load DLL: 'msrdo20.dll'"
. This occurs both in the class library's DBEngine.Errors
and the regular VBA Err
object.
This error occurs whether or not the file msrdo20.dll
exists.
I found https://support.microsoft.com/en-us/kb/260369 which says to include ODBCDirect, but that doesn't seem to be relevant.
I found http://www.xtremevbtalk.com/archive/index.php/t-172385.html which suggests removing Microsoft DAO 3.6 from the references and switching to DAO 3.5 -- but doing that breaks things even worse, I get run-time error 429, "ActiveX component can't create object".
This is Windows Server 2012, Excel 2013.
This blog solved that problem for me:
http://pwaldman.com/unable-to-load-msrdo20-dll-or-rdocurs-dll/
Extract:
Resolution
http://www.microsoft.com/en-us/download/details.aspx?id=9183
Open an elevated(admin) command prompt, navigate to C:\Windows\SysWOW64, and register MSRDO20.DLL. The RDOCURS.DLL does not need to be registered.
C:\Windows\System32> cd C:\Windows\SysWOW64
C:\Windows\SysWOW64> regsvr32 MSRDO20.DLL