Visio Guy

Visio Discussions => Programming & Code => Topic started by: Thomas Winkel on July 04, 2015, 05:57:54 PM

Title: Automate Visio 2010 from Excel 2013
Post by: Thomas Winkel on July 04, 2015, 05:57:54 PM
Hi,

I have VBA code in an Excel document that controls a Visio application:
Set vApp = GetObject(, "Visio.Application")

In the references I checked:
Microsoft Visio 14.0 Type Library

On a computer with Excel 2010 and Visio 2010 this works.
But on a computer with Excel 2013 and Visio 2010 I get an "Automation error, Library not registered".
I already tried to reinstall Visio and to repair my Office installation with no effects.

Any ideas?

Best regards,
Thomas
Title: Re: Automate Visio 2010 from Excel 2013
Post by: Surrogate on July 05, 2015, 06:41:41 AM
may be try  late binding?
Title: Re: Automate Visio 2010 from Excel 2013
Post by: Thomas Winkel on July 05, 2015, 09:13:13 AM
With late binding it's working.

I guess there is an error in my Visio / Office installation.
For other Office applications the answer is to delete a specific registry key:
http://darrenmyher.com/2013/05/23/after-uninstalling-outlook-2013-get-automation-error-library-not-registered-when-attempting-to-create/

Something like this should also work for me, because I had Visio 2013 installed before for test purposes.

Best regards,
Thomas
Title: Re: Automate Visio 2010 from Excel 2013
Post by: Thomas Winkel on July 12, 2015, 01:34:26 PM
Ok, I followed the instruction of the first answer here:
https://social.msdn.microsoft.com/Forums/en-US/d35f6852-8770-4503-8428-4a7040b654cd/suddenly-automation-error-library-not-registered?forum=isvvba (https://social.msdn.microsoft.com/Forums/en-US/d35f6852-8770-4503-8428-4a7040b654cd/suddenly-automation-error-library-not-registered?forum=isvvba)
and deleted all keys in the registry that contained "Microsoft.Office.Interop.Visio" and referred to version 15 (Visio 2013).
Now it's working.

But it took me an hour to delete all those keys...
Many of our users will have the same problem because they had Visio 2013 installed before we decided to go with Visio 2010.
Is there a quicker way to repair the registry?

Regards,
Thomas
Title: Re: Automate Visio 2010 from Excel 2013
Post by: Surrogate on July 12, 2015, 02:05:06 PM
What about registry cleaners? You also can write code that clean it.
Title: Re: Automate Visio 2010 from Excel 2013
Post by: Thomas Winkel on September 05, 2015, 07:16:14 AM
CCleaner did not solve the problem.
But a concerned colleague located the causal registry key.
The following reg file fixes the issue:


Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00021A98-0000-0000-C000-000000000046}\4.f]