Code needs to know if Visio 2007 Standard or Professional

Started by Jumpy, April 01, 2010, 06:44:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jumpy

Hello,

the document_open event starts a code which turns the external-data window invisible, because most users in our company don't need to know about it. They use Visio 2007 Professional.

Now we have some users, who shall use the same templates and drawings but use Visio 2007 Standard. They will get an error message, because Standard doesn't know the VBA methods concerning external data links.

Therefore I need a small test in my code, which version the user is running, that jumps over the difficult part, if it is the standard version.

Has anyone an idea how to do that? Or should I accept and ignore the error message with "on error resume next"? Is that advisable?

Thanks for your input,
Jumpy

P.S.: Would be a nice extra, if the code could differ between Visio 2010 Standard and Professional, too, because we will certainly upgrade one day.

Nikolay

#1
Hi Jumpy,

You can use this registry key to figure out the edition:
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Visio, value "Edition"

For standard, the value is "STD", for professional, it's "PRO"

Visio 2010, supports this in API:
http://blogs.msdn.com/chhopkin/archive/2010/02/10/checking-the-edition-of-visio-2010-at-runtime.aspx

Although the old "registry" way seems to work as well, you just need to change "12.0" to "14.0"

Here is the VBA code snippet to check the edition using this approach:

Function IsVisioPro()
   Set sh = CreateObject("WScript.Shell")
   IsVisioPro = sh.RegRead("HKLM\Software\Microsoft\Office\12.0\Visio\Edition") = "PRO"
End Function

Jumpy