BUG: Unable to load WinHTTP.dll into Outlook 2007 VBA References

Are you having hard time in adding WinHTTP.dll into Outlook 2007 VBA references on your Vista machine, so let me tell you that we are aware of it. The problem is shown below..


Look at the location part, which is for sure invalid path.

The root cause is the installation of this DLL into the registry.

Windows XP registry:

HKEY_CLASSES_ROOT\TypeLib\{662901FC-6951-4854-9EB2-D9A2570F2B2E}\5.1\0\win32: C:\WINDOWS\System32\winhttp.dll

Vista registry:

HKEY_CLASSES_ROOT\TypeLib\{662901FC-6951-4854-9EB2-D9A2570F2B2E}\5.1\0\win32: %systemroot%\System32\winhttp.dll

When we try to load winhttp on vista, we end up looking in c:\users\<username>\documents\%systemroot%\system32\winhttp.dll

Apparently VBA doesn’t understand this type of path.

Resolution: Change the path and the DLL loads.

Another option could be instead of adding a reference to Outlook use late binding and do a CreateObject call to WinHTTP.dll

Solution Courtesy: Stephen Griffin

You can also fix this with regsvr32 WinHTTP.DLL. The DLL registers the proper path – the bad path is actually part of Vista’s install. 🙁

Incidentally – I think VS works around this issue by trying to expand the registry key even though it’s not a REG_EXPAND_SZ. Didn’t test it though.

Skip to main content