Putting VBA macros/code on the Ribbon

Started by Visisthebest, July 31, 2018, 06:44:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

Are there tools that help to make it easier to put icons on the Ribbon that connect to specific VBA macros/code, to make it easier for users to find and use the functions we develop for them. From what I read I understand this is not quite as easy and fast to do as hoped if you do it 'by hand'.

Advice greatly appreciated!

Max
Visio 2021 Professional

Nikolay

#1
I had a plan to build such a tool...
http://visguy.com/vgforum/index.php?topic=5238.0

Please check out that topic for the related discussion.
Check out "Macro Store" from Paul Herber's super-utilities for example.

That would allow people to put some code and bind it to a ribbon button and a keyboard shortcut, and also (optionally) save in the cloud for others to use.
There is in principle a lot of VBA code written, even in this forum.

Also, in principle, this should be achieved by AppStore. But it's already years and the store is still not there :(
According to other office apps, it's also a point that javascript API is rather limited; means, you can't really do all the stuff with it you could do with VBA.

I even started writing something here 3 years ago:
https://github.com/nbelyh/VisioMacroTab

Would you love to have such a tool? Would you volunteer to test it?

There are some issues of course. First, it is started in C++. For the reasons of having good integration with script engine API.
But this discourages all possible contributors, leaving you alone. Probably it should be C# anyways, although it has bad points when implementing scripting API.
Second, I would not go for crippled Scintalla code editor when you have brilliant "monaco" code editor (that, unfortunately, does not support VBA at the level it supports javascript, like autocomplete, etc)
Since the outdated winforms browser control in C# will be replaced in the nearest future with something that is more sane, monaco could be fine.

Visisthebest

Wow Nikolay thank you, this is not a simple thing I see unfortunately.

I'll probably start off putting functionality on the right-click menu of shapes as that is reasonably straightforward and revisit the ribbon later.

I saw your backsync tool here:
http://unmanagedvisio.com/products/visio-back-sync/

Extremely cool I look forward to testing it with large accident investigation diagrams (they are almost identical to cross-functional flowcharts to get an idea of their structure, but mostly with rectangular event shapes).

Max
Visio 2021 Professional

Nikolay

Adding a button IS relatively easy, if you just want to put a single button for a single file (or template), you don't even need any code - you could add it with office custom UI editor.
Seems to me that it has been made open source last year: https://github.com/OfficeDev/office-custom-ui-editor

I just was thinking about a bit more generic solution... So do I see it correctly, you don't seem to be enthusiastic about the idea of this idea either? :)

Visisthebest

Yes I mean a generic solution, but one that comfortably supports this key idea behind the Ribbon: context-sensitivity so it shows options based on the shape you selected for instance.

I am enthusiastic about it, but have so much other todos my plan is to revisit this and just put functions on the right-click menu for now.

I did some testing generating lots of shapes in Visio for diagram sizes we expect, and I see Visio slowing down significantly for 5000+ shape size diagrams. What I also notice is that things like copy-pasting about 200 shapes is slow, even just the simple block shapes from the original Visio stencil.

This speed issue is my primary worry, because I think I need to make choices that keep performance optimal.

If you have any tips about what to avoid to keep Visio performing well much appreciated! I don't want to paint myself in to a corner in this regard. Fortunately we can specificy a fast PC with lots of memory is required for large diagrams, but still anything that would cause a non-linear slowdown to a crawl I need to avoid. Would 64 bits Visio help for large diagrams as it could allocate a lot more memory for mega-diagrams?
Visio 2021 Professional

wapperdude

...and exactly why do you need such a large drawing?  There might be alternative approaches that allow for a simpler file construction.

Wapperdude
Visio 2019 Pro

Nikolay

BTW, has anyone some test data (quantitive) for Visio performance? Not complains like "Visio 2013 is slooooow" but quantitive?
Like, Visio 2013/2016 performance vs. Visio 2010/2007 performance for diagrams with, say having 50, 500, 5000 shapes. Also, relative memory consumption.
Automation API calls could be interesting. Like, dropping/changing/deleting 50, 500, 5000 shapes in Visio 2010 and in 2016..?

Visisthebest

We can't really avoid large diagrams although most often we can only show parts and filter out the detailed data, in accident investigation automated logging adds a lot of relevant data (think of an accident during production at a factory, with lots of systems logging events relevant or potentially relevant to the accident).

It is a good idea to write some automated speed testing for large diagrams and the amount of connections in those diagrams (and complexity of the shapes and other aspects). Use VBA to generate tons of shapes connected to each other and measure the time certain actions take as the diagram grows.

I wonder if running Visio in 64 bits on a fast notebook like the Surface Book 2 with lots of RAM makes it much faster with large diagrams.
Visio 2021 Professional