Using the right Visio type library for different Visio versions

Started by RSut, October 18, 2017, 04:17:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RSut

I DO NOT use Visio 2010 and 2013 simultaneously in the same PC. I take it that if I have the right type libraries, then I can use either (one at a time), without problems?

At present, when I call Visio2010.vsd from Excel with ref: Visio 14.0 type library
Set visDoc = visApp.Documents.Open("D:\nn\mm\Visio2010.vsd") I open my Visio 2010 file

but when I try to call Visio2010.vsdm file (Visio 2013), from excel with with ref: Visio 14.0 type library, I get an error:
Set visDoc = visApp.Documents.Open("D:\nn\mm\Visio2013.vsdm")  get Err.Number 424; object required

For the Excel and Visio files, I have set up my trust centre to allow computation where they are located.

When I opened Visio 2010 via VBA located in Excel 2010, I added the Visio 14.0 type library to the Excel References.
When I opened Visio 2013 on the same PC with Excel 2010, I sought the next Visio type library (15.0?) in Excel References, but it was not available.
Where can I get the new type library from? - And how do I get the type library for Visio 365?

One further question. When using VBA in Visio 365 to open Visio 2010, 2013, 2016, I expect to add the respective type library. However, Excel 365 is serially updated by Microsoft. Does the presence of references for the respective type libraries ever get disturbed (libraries LOST) when Excel 365 is updated?

I would be grateful for help!
Thanks,
RSut


Surrogate

You can try use LATE BINDING
Dim visApp as Object
' define visApp vaeiable
Set visApp = GetObject(, "Visio.Application") ' or
'Set visApp = CreateObject("Visio.Application")

RSut

Thanks!
I dont know late binding.
How would I open a Visio .vsdm file? from Excel without a Visio 15.0 type library?
Also I would need to objectivise the .vsdm file to drive it from Excel

Surrogate

Quote from: RSut on October 18, 2017, 09:53:03 PMHow would I open a Visio .vsdm file? from Excel without a Visio 15.0 type library?
When you use late binding visApp variable will associated with installed on your PC Visio application (Visio version haven't matter)!
Do you can open vsdm-files on PC with Visio 2010 ? On my side Compatibility Pack dont works :(

RSut

I dont want to use late binding because:
The final piece is not small and involves complex flows of data back and forward between Excel and Visio..
Early binding enables me to use the VBE Object browser and Auto List members option which help in writing and correcting code.

Thee final piece WILL use a single version of visio (so I dont need to use late binding to accommodate multiple visio versions).

I just dont know how to access Type libraries that are not pre-displayed in the VBE References List  :)

Yacine

Use both. Early binding for development, then switch to late binding before publishing.
Yacine

RSut


Yacine - Thanks, that gives me coding support for development and version-independence for distribution.

Please can you tell me, WHERE do I find the Type libraries for Visio 2013 and 2016, and is it straightforward to load them stably into Excel 365?

Yacine

You don't search for the libraries. As far as I know, you need Visio installed on your machine and the version does not matter, since with early binding you write for your own version.

If you're asking for the name of the library for Visio 2013 for instance it is "Microsoft Visio 15.0 Type Library" (vislib.dll).
Yacine